public class UniqueJobQueue<T extends Job> extends Object
Object.equals(java.lang.Object)
and Object.hashCode() methods of the job itself, and is therefore the
responsibility of the programmer.| Constructor and Description |
|---|
UniqueJobQueue() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Empty the queue.
|
void |
drain()
Block until the queue is empty.
|
T |
pollJob()
Non-blocking.
|
boolean |
removeJob(T job)
Remove a job from the queue if it has not already been executed.
|
boolean |
rescheduleJob(T job)
Adds a job to the front of the queue.
|
boolean |
scheduleJobIfNotScheduled(T job)
Adds a job to the front of the queue, but only if it is not on the
queue yet.
|
T |
takeJob()
Blocking.
|
public T takeJob() throws InterruptedException
InterruptedExceptionpublic T pollJob()
public boolean scheduleJobIfNotScheduled(T job)
job - The job to schedule.true if the job was scheduled, false if
it already was on the queue.public boolean rescheduleJob(T job)
job - The job to schedule.true if the job already existed on the queue,
false if it did not.public boolean removeJob(T job)
job - The job to remove.true if the job was still on the queue and has been
removed.public void drain()
throws InterruptedException
InterruptedExceptionpublic void clear()
Copyright © 2011–2025 pepsoft.org. All rights reserved.