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
A
ThreadPoolExecutor
that 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
Modifier and TypeFieldDescriptionprotected final io.dropwizard.metrics5.Counter
protected final String
protected final ConcurrentLinkedQueue<Work>
List of running Work instances, in order to be able to interrupt them if requested.protected final io.dropwizard.metrics5.Counter
protected final io.dropwizard.metrics5.Counter
protected final io.dropwizard.metrics5.Timer
-
Constructor Summary
ModifierConstructorDescriptionprotected
WorkThreadPoolExecutor
(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, NuxeoBlockingQueue queue, ThreadFactory threadFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterExecute
(Runnable r, Throwable t) protected void
beforeExecute
(Thread t, Runnable r) void
void
Deprecated.since 10.2 because unusedint
void
removeScheduled
(String workId) void
Initiates a shutdown of this executor and asks for work instances to suspend themselves.protected void
go through the queue instead of using super.execute which may skip the queue and hand off to a thread directlyMethods 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 Details
-
queueId
-
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 Details
-
WorkThreadPoolExecutor
protected WorkThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, NuxeoBlockingQueue queue, ThreadFactory threadFactory)
-
-
Method Details
-
getScheduledOrRunningSize
public int getScheduledOrRunningSize() -
execute
- Specified by:
execute
in interfaceExecutor
- Overrides:
execute
in classThreadPoolExecutor
-
execute
Deprecated.since 10.2 because unusedExecutes the given task sometime in the future.- Parameters:
work
- the work to execute- See Also:
-
submit
go through the queue instead of using super.execute which may skip the queue and hand off to a thread directly- Throws:
RuntimeException
-
beforeExecute
- Overrides:
beforeExecute
in classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecute
in classThreadPoolExecutor
-
shutdownAndSuspend
Initiates a shutdown of this executor and asks for work instances to suspend themselves.- Throws:
InterruptedException
-
removeScheduled
-