Package org.nuxeo.ecm.core.work
Class WorkManagerImpl.WorkThreadPoolExecutor
- java.lang.Object
 - 
- java.util.concurrent.AbstractExecutorService
 - 
- java.util.concurrent.ThreadPoolExecutor
 - 
- org.nuxeo.ecm.core.work.WorkManagerImpl.WorkThreadPoolExecutor
 
 
 
 
- 
- All Implemented Interfaces:
 Executor,ExecutorService
- Enclosing class:
 - WorkManagerImpl
 
protected class WorkManagerImpl.WorkThreadPoolExecutor extends ThreadPoolExecutor
AThreadPoolExecutorthat keeps available the list of running tasks.Completed tasks are passed to another queue.
The scheduled queue and completed list are passed as arguments and can have different implementations (in-memory, persisted, etc).
- Since:
 - 5.6
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy 
 - 
 
- 
Field Summary
Fields Modifier and Type Field Description protected io.dropwizard.metrics5.CountercompletedCountprotected StringqueueIdprotected ConcurrentLinkedQueue<Work>runningList of running Work instances, in order to be able to interrupt them if requested.protected io.dropwizard.metrics5.CounterrunningCountprotected io.dropwizard.metrics5.CounterscheduledCountprotected io.dropwizard.metrics5.TimerworkTimer 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedWorkThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, NuxeoBlockingQueue queue, ThreadFactory threadFactory) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidafterExecute(Runnable r, Throwable t)protected voidbeforeExecute(Thread t, Runnable r)voidexecute(Runnable r)voidexecute(Work work)Deprecated.since 10.2 because unusedintgetScheduledOrRunningSize()voidremoveScheduled(String workId)voidshutdownAndSuspend()Initiates a shutdown of this executor and asks for work instances to suspend themselves.protected voidsubmit(Work work)go through the queue instead of using super.execute which may skip the queue and hand off to a thread directly- 
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString 
- 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit 
 - 
 
 - 
 
- 
- 
Field Detail
- 
running
protected final ConcurrentLinkedQueue<Work> running
List of running Work instances, in order to be able to interrupt them if requested. 
- 
scheduledCount
protected final io.dropwizard.metrics5.Counter scheduledCount
 
- 
runningCount
protected final io.dropwizard.metrics5.Counter runningCount
 
- 
completedCount
protected final io.dropwizard.metrics5.Counter completedCount
 
- 
workTimer
protected final io.dropwizard.metrics5.Timer workTimer
 
 - 
 
- 
Constructor Detail
- 
WorkThreadPoolExecutor
protected WorkThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, NuxeoBlockingQueue queue, ThreadFactory threadFactory)
 
 - 
 
- 
Method Detail
- 
getScheduledOrRunningSize
public int getScheduledOrRunningSize()
 
- 
execute
public void execute(Runnable r)
- Specified by:
 executein interfaceExecutor- Overrides:
 executein classThreadPoolExecutor
 
- 
execute
@Deprecated public void execute(Work work)
Deprecated.since 10.2 because unusedExecutes the given task sometime in the future.- Parameters:
 work- the work to execute- See Also:
 execute(Runnable)
 
- 
submit
protected void submit(Work work) throws RuntimeException
go through the queue instead of using super.execute which may skip the queue and hand off to a thread directly- Throws:
 RuntimeException
 
- 
beforeExecute
protected void beforeExecute(Thread t, Runnable r)
- Overrides:
 beforeExecutein classThreadPoolExecutor
 
- 
afterExecute
protected void afterExecute(Runnable r, Throwable t)
- Overrides:
 afterExecutein classThreadPoolExecutor
 
- 
shutdownAndSuspend
public void shutdownAndSuspend() throws InterruptedException
Initiates a shutdown of this executor and asks for work instances to suspend themselves.- Throws:
 InterruptedException
 
- 
removeScheduled
public void removeScheduled(String workId)
 
 - 
 
 -