Package com.j_spaces.kernel
Class ManagedRunnable
java.lang.Object
com.j_spaces.kernel.ManagedRunnable
- Direct Known Subclasses:
AbstractSelectorThread,ClientConversationRunner,SelectorManager
A Managed Runnable is a convenient superclass for Runnables that want to support graceful
shutdown of threads. When someone wants the thread to be shut down, it calls requestShutdown().
The thread periodically checks if it should shut down by calling shouldShutdown(), and returns
from run() if it should.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRequest shutdown, this method will be block depends the waitWhileFinish() method implementation.booleanprotected abstract voidThis method will be invoked by requestShutdown().
-
Constructor Details
-
ManagedRunnable
public ManagedRunnable()
-
-
Method Details
-
requestShutdown
public void requestShutdown()Request shutdown, this method will be block depends the waitWhileFinish() method implementation. -
shouldShutdown
public boolean shouldShutdown() -
waitWhileFinish
protected abstract void waitWhileFinish()This method will be invoked by requestShutdown(). Request method will be block while waitWhileFinish() will not be finished.
-