Class JobQueue
- java.lang.Object
-
- net.officefloor.frame.impl.spi.team.JobQueue
-
public class JobQueue extends java.lang.ObjectQueue ofJobinstances.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Jobdequeue()Thread-safe dequeuing the nextJobto execute.Jobdequeue(long timeout)Thread-safe dequeuing the nextJobto execute.voidenqueue(Job job)Thread-safe enqueues aJobto the queue.booleanisEmpty()Indicates if noJobinstances within the queue.voidwaitForTask(long timeout)Waits the input period of time for anotherJobto be added.voidwakeUp()Wakes up waiting on aJob.
-
-
-
Constructor Detail
-
JobQueue
public JobQueue()
Initiate with private lock.
-
JobQueue
public JobQueue(java.lang.Object lock)
Initiate.- Parameters:
lock- Lock for coordinating thisJobQueue.
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Indicates if noJobinstances within the queue.- Returns:
- No
Jobinstances within the queue.
-
enqueue
public void enqueue(Job job)
Thread-safe enqueues aJobto the queue.- Parameters:
job-Jobto add to the queue.
-
dequeue
public Job dequeue(long timeout)
-
wakeUp
public void wakeUp()
Wakes up waiting on aJob.
-
waitForTask
public void waitForTask(long timeout)
Waits the input period of time for anotherJobto be added.- Parameters:
timeout- Time to wait in milliseconds.
-
-