net.sf.freecol.client
Class Worker

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.freecol.client.Worker
All Implemented Interfaces:
java.lang.Runnable

public final class Worker
extends java.lang.Thread

The Worker Thread executes jobs one after another. The thread manages a queue where new jobs can be enqueued. The jobs are processed synchronously by the worker.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Worker()
           
 
Method Summary
 void askToStop()
          Makes the worker thread stop running.
 void run()
           
 void schedule(java.lang.Runnable job)
          Adds a new job to the queue
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Worker

public Worker()
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

schedule

public void schedule(java.lang.Runnable job)
Adds a new job to the queue

Parameters:
job - the job to add to the queue.

askToStop

public void askToStop()
Makes the worker thread stop running.