Package com.openfin.desktop
Class OpenFinThreadPool
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- com.openfin.desktop.OpenFinThreadPool
-
- All Implemented Interfaces:
Executor,ExecutorService
public class OpenFinThreadPool extends ThreadPoolExecutor
Fixed size thread pool that logs warning messages if a task is unable to acquire a thread to execute it after the given time. The default timeout for the warning is 10000ms and it can be modified via system property "com.openfin.desktop.threadpool.pendingtask.timeout"- Author:
- Anthony
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Constructor Summary
Constructors Constructor Description OpenFinThreadPool(String name, int nThreads)Creates a fixed size thread pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterExecute(Runnable task, Throwable t)protected voidbeforeExecute(Thread thread, Runnable task)voidexecute(Runnable task)-
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
-
-
-
-
Constructor Detail
-
OpenFinThreadPool
public OpenFinThreadPool(String name, int nThreads)
Creates a fixed size thread pool.- Parameters:
name- name of the thread poolnThreads- number of threads in the pool.
-
-
Method Detail
-
execute
public void execute(Runnable task)
- Specified by:
executein interfaceExecutor- Overrides:
executein classThreadPoolExecutor
-
beforeExecute
protected void beforeExecute(Thread thread, Runnable task)
- Overrides:
beforeExecutein classThreadPoolExecutor
-
afterExecute
protected void afterExecute(Runnable task, Throwable t)
- Overrides:
afterExecutein classThreadPoolExecutor
-
-