public interface PriorityExecutor
Modifier and Type | Field and Description |
---|---|
static int |
CANT_REMOVE
Return value for
removeTasksWithMark(Object) if removing is not supported. |
static PriorityExecutor |
DIRECT_EXECUTOR
Priority executor which just executes the task directly without caring for priority.
|
static long |
NO_ID
Return value for
execute(Priority, Object, Runnable) indicating no valid id. |
Modifier and Type | Method and Description |
---|---|
long |
execute(Priority priority,
java.lang.Object mark,
java.lang.Runnable task)
Execute a task with the given priority.
|
long |
executeWithLifeCycle(Priority priority,
TaskLifeCycleListener mark,
java.lang.Runnable task)
Execute a task with the given priority.
|
int |
removeTasksWithMark(java.lang.Object mark)
Remove all tasks which where started with the given mark.
|
boolean |
removeTaskWithId(long id)
Remove the task with the given id.
|
static final long NO_ID
execute(Priority, Object, Runnable)
indicating no valid id.static final int CANT_REMOVE
removeTasksWithMark(Object)
if removing is not supported.static final PriorityExecutor DIRECT_EXECUTOR
long execute(@NotNull Priority priority, @Nullable java.lang.Object mark, @NotNull java.lang.Runnable task)
priority
- priority of taskmark
- mark which allows access to objects in queue.
Not all implementation need to take care of this.task
- task to runNO_ID
if access is no longer possiblelong executeWithLifeCycle(@NotNull Priority priority, @NotNull TaskLifeCycleListener mark, @NotNull java.lang.Runnable task)
priority
- priority of taskmark
- mark which allows access to objects in queue, and also gets informed
when the task is enqueued, started and finished.
Not all implementation need to take care of this.task
- task to runNO_ID
if access is no longer possibleint removeTasksWithMark(@NotNull java.lang.Object mark)
mark
- mark to check forCANT_REMOVE
if the executor does not allow removingboolean removeTaskWithId(long id)
id
- idtrue
if a rask with the given id was found and removedfalse
: if none was found