The Meta-Environment API

toolbus
Class AbstractTool.WorkerQueue

java.lang.Object
  extended by toolbus.AbstractTool.WorkerQueue
Enclosing class:
AbstractTool

private static class AbstractTool.WorkerQueue
extends java.lang.Object

The queue that is meant to take care of the asynchroneous execution and queueing of anything that invokes stuff on a tool.

Author:
Arnold Lankamp

Nested Class Summary
private  class AbstractTool.WorkerQueue.Worker
          The worker thread of this queue.
 
Field Summary
private  java.lang.Object lock
           
private  java.util.Queue<java.lang.Runnable> queue
           
private  AbstractTool.WorkerQueue.Worker worker
           
 
Constructor Summary
AbstractTool.WorkerQueue()
          Default constructor.
 
Method Summary
 void execute(java.lang.Runnable r)
          Executes or queues the given runnable for execution.
 void start()
          Starts the worker thread.
 void terminate()
          Terminates the worker thread as soon as is gracefully possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

private final java.lang.Object lock

queue

private final java.util.Queue<java.lang.Runnable> queue

worker

private final AbstractTool.WorkerQueue.Worker worker
Constructor Detail

AbstractTool.WorkerQueue

public AbstractTool.WorkerQueue()
Default constructor.

Method Detail

start

public void start()
Starts the worker thread.


execute

public void execute(java.lang.Runnable r)
Executes or queues the given runnable for execution.

Parameters:
r - The runnable containing the stuff that needs to be executed.

terminate

public void terminate()
Terminates the worker thread as soon as is gracefully possible.


The Meta-Environment API