uk.ac.ic.doc.automed.util.queue
Class QueueWorker

java.lang.Object
  extended by uk.ac.ic.doc.automed.util.queue.QueueWorker
All Implemented Interfaces:
Threadable

public class QueueWorker
extends java.lang.Object
implements Threadable


Constructor Summary
QueueWorker(Queue queue, JobHandler handlerObj)
          Creates a new instance of QueueWorker
 
Method Summary
protected  void addJobHandler(JobHandler handlerObj)
          Register a new job handler for jobs.
static java.lang.String getHandlerType(JobHandler handlerObj)
          Utility method to standardise JobHandler the type of a job handler
 boolean getReadyState()
           
 void handleAction()
           
 void runAction()
          Get the next job in queue to process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueWorker

public QueueWorker(Queue queue,
                   JobHandler handlerObj)
Creates a new instance of QueueWorker

Method Detail

addJobHandler

protected void addJobHandler(JobHandler handlerObj)
Register a new job handler for jobs. This method should only be called
by Queue object every time a new job is added to it


getReadyState

public boolean getReadyState()
Specified by:
getReadyState in interface Threadable

runAction

public void runAction()
               throws AutoMedException
Get the next job in queue to process

Specified by:
runAction in interface Threadable
Throws:
AutoMedException

handleAction

public void handleAction()
Specified by:
handleAction in interface Threadable

getHandlerType

public static java.lang.String getHandlerType(JobHandler handlerObj)
Utility method to standardise JobHandler the type of a job handler

Returns:
String handler type