public interface WorkQueuing
WorkManager
implements queuing.
There are 4 structures maintained per-queue:
ThreadPoolExecutor
,ThreadPoolExecutor
and not yet executed (not yet running).Modifier and Type | Interface and Description |
---|---|
static interface |
WorkQueuing.Listener |
Modifier and Type | Method and Description |
---|---|
long |
count(String queueId,
Work.State state)
Gets the number of work instances in the given state in a given queue.
|
Work |
find(String workId,
Work.State state)
Finds a work instance in the scheduled or running or completed sets.
|
NuxeoBlockingQueue |
getQueue(String queueId)
Gets the blocking queue of work used by the
ThreadPoolExecutor . |
Work.State |
getWorkState(String workId)
Gets the state in which a work instance is.
|
NuxeoBlockingQueue |
init(WorkQueueDescriptor config)
Starts up this
WorkQueuing and attempts to resume work previously suspended and saved at shutdown time. |
boolean |
isWorkInState(String workId,
Work.State state)
Checks if a work instance with the given id is in the given state.
|
void |
listen(WorkQueuing.Listener listener)
Set the callback for debugging purpose
|
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.
|
WorkQueueMetrics |
metrics(String queueId)
Returns current metrics of queue identified by the
queueId |
void |
removeScheduled(String queueId,
String workId)
Finds a scheduled work instance and removes it from the scheduled queue.
|
void |
setActive(String queueId,
boolean value)
Enable/disable this
queueId processing |
void |
workCanceled(String queueId,
Work work)
Removes a work instance from scheduled set.
|
void |
workCompleted(String queueId,
Work work)
Moves a work instance from the running set to the completed set.
|
void |
workReschedule(String queueId,
Work work)
Moves back a work instance from running set to the scheduled set.
|
void |
workRunning(String queueId,
Work work)
Put the work instance into the running set.
|
void |
workSchedule(String queueId,
Work work)
Submit a work to the
ThreadPoolExecutor and put it in the scheduled set. |
NuxeoBlockingQueue init(WorkQueueDescriptor config)
WorkQueuing
and attempts to resume work previously suspended and saved at shutdown time.void setActive(String queueId, boolean value)
queueId
processingNuxeoBlockingQueue getQueue(String queueId)
ThreadPoolExecutor
.queueId
- void workSchedule(String queueId, Work work)
ThreadPoolExecutor
and put it in the scheduled set.queueId
- the queue idwork
- the work instancevoid workCanceled(String queueId, Work work)
void workRunning(String queueId, Work work)
queueId
- the queue idwork
- the work instancevoid workCompleted(String queueId, Work work)
queueId
- the queue idwork
- the work instancevoid workReschedule(String queueId, Work work)
Work find(String workId, Work.State state)
void removeScheduled(String queueId, String workId)
queueId
- the queue idworkId
- the id of the work to findboolean isWorkInState(String workId, Work.State state)
Work.State getWorkState(String workId)
This can be Work.State.SCHEDULED
, Work.State.RUNNING
, State#COMPLETED
, State#FAILED
, or
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)
long count(String queueId, Work.State state)
WorkQueueMetrics metrics(String queueId)
queueId
void listen(WorkQueuing.Listener listener)
Copyright © 2018 Nuxeo. All rights reserved.