|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jdmk.DaemonTaskServer
This class inplements a Task Server that runs in its own
thread.
Objects can submit tasks to this object, and they will be executed
in background in this object deamon thread. The submitted tasks
should not block or last too long - because it will prevent following
tasks to be executed.
When a task producer calls the
submitTask(Task)
method, the task is put inside a FIFO
list, and the Task Server Thread is woken up, if necessary.
After that, the method return.
The Task Server Thread then asynchronously takes the tasks out of the FIFO list, and invokes the run() method.
This mechanism guarantee that the Task producer will spend a minimum time invoking the tasks, and will not be blocked.
Constructor Summary | |
DaemonTaskServer()
|
Method Summary | |
protected void |
cancel(Task task)
|
protected void |
execute(Task task)
|
void |
reset()
|
void |
run()
Implements the Task Server Thread loop. |
void |
start()
Start the Task Server Thread. |
void |
stop()
Stop the Task Server Thread. |
void |
submitTask(Task task)
Submit a task. |
void |
terminate()
Stop the Task Server Thread. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public DaemonTaskServer()
Method Detail |
public void run()
protected void execute(Task task) throws java.lang.InterruptedException
protected void cancel(Task task) throws java.lang.InterruptedException
public void submitTask(Task task)
task
- The Task to execute.public void stop() throws java.lang.InterruptedException
public void terminate() throws java.lang.InterruptedException
submitTask()
.
When terminated, the object can not be started again.public void reset()
public void start()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |