Package com.openfin.desktop
Class OpenFinThreadPool
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
com.openfin.desktop.OpenFinThreadPool
- All Implemented Interfaces:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
public class OpenFinThreadPool
extends java.util.concurrent.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
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
Constructor Summary
Constructors Constructor Description OpenFinThreadPool(java.lang.String name, int nThreads)
Creates a fixed size thread pool. -
Method Summary
Modifier and Type Method Description protected void
afterExecute(java.lang.Runnable task, java.lang.Throwable t)
protected void
beforeExecute(java.lang.Thread thread, java.lang.Runnable task)
void
execute(java.lang.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
-
Constructor Details
-
OpenFinThreadPool
public OpenFinThreadPool(java.lang.String name, int nThreads)Creates a fixed size thread pool.- Parameters:
name
- name of the thread poolnThreads
- number of threads in the pool.
-
-
Method Details
-
execute
public void execute(java.lang.Runnable task)- Specified by:
execute
in interfacejava.util.concurrent.Executor
- Overrides:
execute
in classjava.util.concurrent.ThreadPoolExecutor
-
beforeExecute
protected void beforeExecute(java.lang.Thread thread, java.lang.Runnable task)- Overrides:
beforeExecute
in classjava.util.concurrent.ThreadPoolExecutor
-
afterExecute
protected void afterExecute(java.lang.Runnable task, java.lang.Throwable t)- Overrides:
afterExecute
in classjava.util.concurrent.ThreadPoolExecutor
-