public class PriorityCallable<T> extends Object implements Callable<T>, PriorityTask
Callables
that adheres to a priority by implementing PriorityTask
. Uses a
combination of priority
and index
to compare between this
and other priority task instances.
A calculator (e.g. CommandPriorityCalculator
) defines the
priority of the task. This task uses the index
to differentiate between tasks with the same priority,
ensuring the insert order is leading in those scenarios.CommandPriorityCalculator
,
QueryPriorityCalculator
Constructor and Description |
---|
PriorityCallable(Callable<T> task,
long priority,
long sequence)
Construct a priority task.
|
Modifier and Type | Method and Description |
---|---|
T |
call() |
boolean |
equals(Object o) |
int |
hashCode() |
long |
priority()
Returns the priority of this task.
|
long |
sequence()
Returns the sequence of this task.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo
public PriorityCallable(Callable<T> task, long priority, long sequence)
task
- The Callable
that should be executed with a priority
.priority
- The priority of the task
to execute, dedicating the order among tasks.sequence
- The sequence of the task
to execute, dedicating the order among equal priority
tasks.public long priority()
PriorityTask
priority
in interface PriorityTask
public long sequence()
PriorityTask
sequence
in interface PriorityTask
Copyright © 2010–2023. All rights reserved.