com.github.libxjava.concurrent
Class AbstractSingleThreadRunner
java.lang.Object
com.github.libxjava.concurrent.AbstractSingleThreadRunner
public abstract class AbstractSingleThreadRunner
- extends Object
- Version:
- libxjava-cldc - 0.3
- Author:
- Marcel Patzlaff
STARTED
public static final byte STARTED
- See Also:
- Constant Field Values
STOPPED
public static final byte STOPPED
- See Also:
- Constant Field Values
AbstractSingleThreadRunner
protected AbstractSingleThreadRunner(String name)
getName
public final String getName()
start
public final boolean start()
stop
public final boolean stop()
isInState
public final boolean isInState(byte requiredState)
waitForState
public final boolean waitForState(int timeout,
byte requiredState)
throws InterruptedException
- Throws:
InterruptedException
doRun
protected abstract void doRun()
forkExecution
protected void forkExecution(Runnable runnable,
String name)
- This method is called on behalf of the
start() method.
It must set up the concurrent execution of the specified runnable.
The default implementation just creates a new thread and starts it.
- Parameters:
runnable - to execute in a concurrent threadname - an optional name for the thread
unblock
protected void unblock()
- This method is called on behalf of the
stop() method.
If the runner performs blocking operations like I/O reads or
synchronized waits, the implementing class should unblock/notify
the runner in this method.
The default implementation just signals interruption to the
working thread
isCancelled
protected final boolean isCancelled()
Copyright © 2011 Marcel Patzlaff. All Rights Reserved.