Class CPMExecutorService
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.apache.uima.collection.impl.cpm.engine.CPMExecutorService
- All Implemented Interfaces:
AutoCloseable, Executor, ExecutorService
This component catches uncaught errors in the CPM. All critical threads in the CPM are part of
this executor service. If OutOfMemory Error is thrown this component is notified by the JVM and
its job is to notify registered listeners.
-
Nested Class Summary
Nested classes/interfaces inherited from class ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterExecute(Runnable aThread, Throwable aThrowable) voidcleanup()Cleanup.protected <T> RunnableFuture<T> newTaskFor(Runnable aRunnable, T aValue) protected <T> RunnableFuture<T> newTaskFor(Callable<T> aCallable) voidsetContextClassLoader(ClassLoader aClassLoader) Sets the thread context class loader (TCCL) that the worker threads should run under.voidsetListeners(List<BaseStatusCallbackListener> aListenerList) Sets listeners to be used in notifications.voidsetProcessTrace(ProcessTrace aProcessTrace) Sets the process trace.protected voidMethods inherited from class ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, 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, toStringMethods inherited from class AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submitMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ExecutorService
close
-
Constructor Details
-
CPMExecutorService
public CPMExecutorService()
-
-
Method Details
-
setContextClassLoader
Sets the thread context class loader (TCCL) that the worker threads should run under. This is applied to each task individually (and restored afterwards), so that pooled worker threads - which may carry a stale TCCL from an earlier, unrelated task - run the CPM work under the loader captured from the control thread that started the processing (see issue #254). Anullvalue (the default) leaves the worker threads' TCCL untouched.- Parameters:
aClassLoader- the class loader to use as the worker threads' TCCL, ornullto leave it unchanged
-
setListeners
Sets listeners to be used in notifications.- Parameters:
aListenerList- list of registered listeners
-
setProcessTrace
Sets the process trace.- Parameters:
aProcessTrace- the new process trace
-
afterExecute
- Overrides:
afterExecutein classThreadPoolExecutor
-
cleanup
public void cleanup()Cleanup. -
terminated
protected void terminated()- Overrides:
terminatedin classThreadPoolExecutor
-
newTaskFor
- Overrides:
newTaskForin classAbstractExecutorService
-
newTaskFor
- Overrides:
newTaskForin classAbstractExecutorService
-