Package org.nuxeo.ecm.core.work
Interface WorkQueuing
- All Known Implementing Classes:
 MemoryWorkQueuing
public interface WorkQueuing
Interface describing how the 
WorkManager implements queuing.
 There are 4 structures maintained per-queue:
- the work queue managed by the 
ThreadPoolExecutor, - the set of scheduled work, this enables to list a work as being scheduled while it has been removed from the
 queue by the 
ThreadPoolExecutorand not yet executed (not yet running). - the set of running work,
 - the set of completed work.
 
- Since:
 - 5.8
 
- 
Nested Class Summary
Nested Classes - 
Method Summary
Modifier and TypeMethodDescriptionlongcount(String queueId, Work.State state) Gets the number of work instances in the given state in a given queue.find(String workId, Work.State state) Finds a work instance in the scheduled or running or completed sets.Gets the blocking queue of work used by theThreadPoolExecutor.getWorkState(String workId) Gets the state in which a work instance is.init(WorkQueueDescriptor config) Starts up thisWorkQueuingand attempts to resume work previously suspended and saved at shutdown time.booleanisWorkInState(String workId, Work.State state) Checks if a work instance with the given id is in the given state.voidlisten(WorkQueuing.Listener listener) Set the callback for debugging purposelistWork(String queueId, Work.State state) Lists the work instances in a given queue in a defined state.listWorkIds(String queueId, Work.State state) Lists the work ids in a given queue in a defined state.Returns current metrics of queue identified by thequeueIdvoidremoveScheduled(String queueId, String workId) Finds a scheduled work instance and removes it from the scheduled queue.voidEnable/disable thisqueueIdprocessingbooleanvoidworkCanceled(String queueId, Work work) Removes a work instance from scheduled set.voidworkCompleted(String queueId, Work work) Moves a work instance from the running set to the completed set.voidworkReschedule(String queueId, Work work) Moves back a work instance from running set to the scheduled set.voidworkRunning(String queueId, Work work) Put the work instance into the running set.voidworkSchedule(String queueId, Work work) Submit a work to theThreadPoolExecutorand put it in the scheduled set. 
- 
Method Details
- 
init
Starts up thisWorkQueuingand attempts to resume work previously suspended and saved at shutdown time. - 
setActive
Enable/disable thisqueueIdprocessing- Since:
 - 8.3
 
 - 
supportsProcessingDisabling
boolean supportsProcessingDisabling()- Returns:
 - true if the implementation supports processing disabling
 - Since:
 - 10.3
 
 - 
getQueue
Gets the blocking queue of work used by theThreadPoolExecutor.- Since:
 - 8.1
 
 - 
workSchedule
Submit a work to theThreadPoolExecutorand put it in the scheduled set.- Parameters:
 queueId- the queue idwork- the work instance- Since:
 - 8.1
 
 - 
workCanceled
Removes a work instance from scheduled set.- Since:
 - 8.3
 
 - 
workRunning
Put the work instance into the running set.- Parameters:
 queueId- the queue idwork- the work instance- Since:
 - 5.8
 
 - 
workCompleted
Moves a work instance from the running set to the completed set.- Parameters:
 queueId- the queue idwork- the work instance- Since:
 - 5.8
 
 - 
workReschedule
Moves back a work instance from running set to the scheduled set.- Since:
 - 8.3
 
 - 
find
Finds a work instance in the scheduled or running or completed sets. - 
removeScheduled
Finds a scheduled work instance and removes it from the scheduled queue.- Parameters:
 queueId- the queue idworkId- the id of the work to find- Since:
 - 5.8
 
 - 
isWorkInState
Checks if a work instance with the given id is in the given state. - 
getWorkState
Gets the state in which a work instance is.This can be
Work.State.SCHEDULEDorWork.State.RUNNING.- Parameters:
 workId- the id of the work to find- Returns:
 - the work state, or 
nullif not found - Since:
 - 5.8
 
 - 
listWork
Lists the work instances in a given queue in a defined state.Note that an instance requested as RUNNING could be found SUSPENDING or SUSPENDED, and an instance requested as COMPLETED could be found FAILED.
 - 
listWorkIds
Lists the work ids in a given queue in a defined state. - 
count
Gets the number of work instances in the given state in a given queue. - 
metrics
Returns current metrics of queue identified by thequeueId- Since:
 - 8.3
 
 - 
listen
Set the callback for debugging purpose- Since:
 - 8.3
 
 
 -