public interface WorkQueuing
WorkManager
implements queuing.
There are 3 structures maintained per-queue:
Modifier and Type | Method and Description |
---|---|
void |
clearCompletedWork(String queueId,
long completionTime)
Clears the list of completed work instances older than the given time in the given queue.
|
Work |
find(String workId,
Work.State state)
Finds a work instance in the scheduled queue or running or completed sets.
|
Set<String> |
getCompletedQueueIds()
Finds which queues have completed work.
|
int |
getQueueSize(String queueId,
Work.State state)
Gets the number of work instances in the given state in a given queue.
|
BlockingQueue<Runnable> |
getScheduledQueue(String queueId)
Gets the blocking queue for scheduled work, to be used in a
ThreadPoolExecutor . |
Work.State |
getWorkState(String workId)
Gets the state in which a work instance is.
|
void |
init()
Starts up this
WorkQueuing and attempts to resume work previously suspended and saved at
#shutdown time. |
BlockingQueue<Runnable> |
initScheduleQueue(String queueId) |
boolean |
isWorkInState(String workId,
Work.State state)
Checks if a work instance with the given id is in the given state.
|
List<Work> |
listWork(String queueId,
Work.State state)
Lists the work instances in a given queue in a defined state.
|
List<String> |
listWorkIds(String queueId,
Work.State state)
Lists the work ids in a given queue in a defined state.
|
Work |
removeScheduled(String queueId,
String workId)
Finds a scheduled work instance and removes it from the scheduled work.
|
int |
setSuspending(String queueId)
Notifies this queuing that all work should be suspending.
|
void |
workCompleted(String queueId,
Work work)
Moves a work instance from the running set to the completed set.
|
void |
workRunning(String queueId,
Work work)
Moves a work instance from the scheduled queue to the running set.
|
void init()
WorkQueuing
and attempts to resume work previously suspended and saved at
#shutdown
time.BlockingQueue<Runnable> initScheduleQueue(String queueId)
queueId
- BlockingQueue<Runnable> getScheduledQueue(String queueId)
ThreadPoolExecutor
.queueId
- the queue idvoid workRunning(String queueId, Work work)
queueId
- the queue idwork
- the work instancevoid workCompleted(String queueId, Work work)
queueId
- the queue idwork
- the work instanceWork find(String workId, Work.State state)
Work removeScheduled(String queueId, String workId)
queueId
- the queue idworkId
- the id of the work to findnull
boolean isWorkInState(String workId, Work.State state)
Work.State getWorkState(String workId)
This can be Work.State.SCHEDULED
, Work.State.RUNNING
, Work.State.COMPLETED
, Work.State.FAILED
, or
Work.State.CANCELED
.
workId
- the id of the work to findnull
if not foundList<Work> listWork(String queueId, Work.State state)
Note that an instance requested as RUNNING could be found SUSPENDING or SUSPENDED, and an instance requested as COMPLETED could be found FAILED.
List<String> listWorkIds(String queueId, Work.State state)
int getQueueSize(String queueId, Work.State state)
int setSuspending(String queueId)
Set<String> getCompletedQueueIds()
void clearCompletedWork(String queueId, long completionTime)
queueId
- the queue idcompletionTime
- the completion time (milliseconds since epoch) before which completed work instances are
cleared, or 0
for allCopyright © 2015 Nuxeo SA. All rights reserved.