public abstract class AbstractPriorityQueueScheduler<T> extends AbstractQueue<Job<T>> implements Scheduler<T>, BlockingQueue<Job<T>>, Closeable
| Constructor and Description |
|---|
AbstractPriorityQueueScheduler() |
| Modifier and Type | Method and Description |
|---|---|
Future<T> |
add(Request r)
Adds a request to the queue
|
Future<T> |
add(Request r,
Handleable h)
Adds a request to the queue
|
Future<T> |
add(Request r,
Handleable h,
Priority p)
Adds a request to the queue
|
Future<T> |
add(Request r,
Priority p)
Adds a request to the queue
|
Future<T> |
add(Request r,
Priority p,
Priority pf)
Adds a request to the queue
|
void |
close() |
int |
drainTo(Collection<? super Job<T>> c) |
int |
drainTo(Collection<? super Job<T>> c,
int maxElements) |
protected PriorityBlockingQueue<Job<T>> |
getQueue() |
Iterator<Job<T>> |
iterator() |
boolean |
offer(Job<T> job) |
boolean |
offer(Job<T> job,
long timeout,
TimeUnit unit) |
Job<T> |
peek() |
Job<T> |
poll()
Retrieves and removes the head of this queue,
or returns
null if this queue is empty. |
Job<T> |
poll(long timeout,
TimeUnit unit)
Retrieves and removes the head of this queue, waiting up to the
specified wait time if necessary for an element to become available.
|
void |
put(Job<T> job) |
int |
remainingCapacity() |
int |
size() |
Job<T> |
take() |
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, contains, removeaddAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayprotected PriorityBlockingQueue<Job<T>> getQueue()
public Future<T> add(Request r, Handleable h, Priority p)
SchedulerThis request would be parsed by the handler specified, and its priority can be downgraded to the default minimum priority
public Future<T> add(Request r, Handleable h)
SchedulerThis request would be parsed by the handler specified, and it's initialised with default priority that can be downgraded to the default minimum priority
public Future<T> add(Request r, Priority p, Priority pf)
SchedulerThis request would be parsed by a handler defined in HandlerRouter or otherwise, and its priority can be downgraded to a minimum priority specified
public Future<T> add(Request r, Priority p)
SchedulerThis request would be parsed by a handler defined in HandlerRouter or otherwise defined, and its priority can be downgraded to the default minimum priority
public Future<T> add(Request r)
SchedulerThis request would be parsed by a handler defined in HandlerRouter or otherwise defined, and it's initialised with default priority that can be downgraded to the default minimum priority
public int size()
size in interface Collection<Job<T>>size in class AbstractCollection<Job<T>>public boolean offer(Job<T> job, long timeout, @Nonnull TimeUnit unit)
offer in interface BlockingQueue<Job<T>>public Job<T> take() throws InterruptedException
take in interface BlockingQueue<Job<T>>InterruptedExceptionpublic Job<T> poll(long timeout, @Nonnull TimeUnit unit) throws InterruptedException
Schedulerpoll in interface Scheduler<T>poll in interface BlockingQueue<Job<T>>timeout - how long to wait before giving up, in units of
unitunit - a TimeUnit determining how to interpret the
timeout parameternull if the
specified waiting time elapses before an element is availableInterruptedException - if interrupted while waitingpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<Job<T>>public int drainTo(@Nonnull Collection<? super Job<T>> c)
drainTo in interface BlockingQueue<Job<T>>public int drainTo(@Nonnull Collection<? super Job<T>> c, int maxElements)
drainTo in interface BlockingQueue<Job<T>>public Job<T> poll()
Schedulernull if this queue is empty.public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2018. All rights reserved.