Class JobQueue
- java.lang.Object
-
- net.officefloor.frame.impl.spi.team.JobQueue
-
public class JobQueue extends java.lang.Object
Queue ofJob
instances.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Job
dequeue()
Thread-safe dequeuing the nextJob
to execute.Job
dequeue(long timeout)
Thread-safe dequeuing the nextJob
to execute.void
enqueue(Job job)
Thread-safe enqueues aJob
to the queue.boolean
isEmpty()
Indicates if noJob
instances within the queue.void
waitForTask(long timeout)
Waits the input period of time for anotherJob
to be added.void
wakeUp()
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 noJob
instances within the queue.- Returns:
- No
Job
instances within the queue.
-
enqueue
public void enqueue(Job job)
Thread-safe enqueues aJob
to the queue.- Parameters:
job
-Job
to 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 anotherJob
to be added.- Parameters:
timeout
- Time to wait in milliseconds.
-
-