Knopflerfish OSGi 5.2.0

org.knopflerfish.util.workerthread
Class WorkerThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.knopflerfish.util.workerthread.WorkerThread
All Implemented Interfaces:
java.lang.Runnable

public class WorkerThread
extends java.lang.Thread


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
WorkerThread()
          Creates a Workerthread.
WorkerThread(java.lang.String name)
          Creates a named Workerthread.
WorkerThread(java.lang.ThreadGroup group, java.lang.String name)
          Creates a named Workerthread belonging toi the specified ThreadGroup.
 
Method Summary
 void addJob(Job job)
          Adds a job to be processed last in the job queue.
 void addJob(Job job, long delayMillis)
          Adds a job to be processed after given delay.
 boolean isRunning()
          Returns true if this Workerthread is running.
protected  void postMainLoopHook()
          Override this method in subclasses.
protected  void preMainLoopHook()
          Override this method in subclasses.
 void removeJob(Job job)
          Removes a job from the job queue (linear-time operation).
 void run()
           
 void shutdown()
          Call this method to stop job processing and cause this Workerthread to exit its run() method.
protected  void status(java.lang.String msg, Job job, java.lang.Exception e)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkerThread

public WorkerThread()
Creates a Workerthread. The start() method must be called externally.


WorkerThread

public WorkerThread(java.lang.String name)
Creates a named Workerthread. The start() method must be called externally.


WorkerThread

public WorkerThread(java.lang.ThreadGroup group,
                    java.lang.String name)
Creates a named Workerthread belonging toi the specified ThreadGroup. The start() method must be called externally.

Method Detail

run

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

preMainLoopHook

protected void preMainLoopHook()
Override this method in subclasses. It is called by the job thread before the event processing is commenced.


postMainLoopHook

protected void postMainLoopHook()
Override this method in subclasses. It is called by the job thread after the job processing has stopped.


shutdown

public void shutdown()
Call this method to stop job processing and cause this Workerthread to exit its run() method.


isRunning

public boolean isRunning()
Returns true if this Workerthread is running. I.e. if it has been stated and the shutdown() method has not been called.


addJob

public void addJob(Job job)
Adds a job to be processed last in the job queue.


addJob

public void addJob(Job job,
                   long delayMillis)
Adds a job to be processed after given delay. When (at least) delayMillis milliseconds has passed, the job will be placed last in the job queue.


removeJob

public void removeJob(Job job)
Removes a job from the job queue (linear-time operation).


status

protected void status(java.lang.String msg,
                      Job job,
                      java.lang.Exception e)

Knopflerfish OSGi 5.2.0