er.extensions.concurrency
Class ERXTaskThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
er.extensions.concurrency.ERXTaskThreadPoolExecutor
- All Implemented Interfaces:
- java.util.concurrent.Executor, java.util.concurrent.ExecutorService
public class ERXTaskThreadPoolExecutor
- extends java.util.concurrent.ThreadPoolExecutor
This is a custom ThreadPoolExecutor subclass whose purpose in life is
- to ensure that we initialize
ERXTaskThread status before task execution and reset status after execution,
- use ERXFutureTask subclass of
FutureTask so we have a reference to the wrapped task.
- tell ERXEC to unlock all editing contexts in the background thread at the end of task execution.
This is accomplished by overriding the protected hook methods ThreadPoolExecutor.beforeExecute(Thread t, Runnable r)
and ThreadPoolExecutor.afterExecute(Runnable r, Throwable t), and also the submit methods.
A user does not generally need to instantiate this class. This class is generally used by ExecutorService instances
that are created by ERXExecutorService static utility methods.
- See Also:
ERXExecutorService,
ERXTaskThreadFactory,
ERXTaskThread- Author:
- kieran
| 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 |
ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
|
ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.RejectedExecutionHandler handler)
|
ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.ThreadFactory threadFactory)
|
ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.ThreadFactory threadFactory,
java.util.concurrent.RejectedExecutionHandler handler)
|
|
Method Summary |
protected void |
afterExecute(java.lang.Runnable r,
java.lang.Throwable t)
|
protected void |
beforeExecute(java.lang.Thread t,
java.lang.Runnable r)
|
<T> java.util.concurrent.Future<T> |
|
submit(java.util.concurrent.Callable<T> task)
|
java.util.concurrent.Future<?> |
submit(java.lang.Runnable task)
|
<T> java.util.concurrent.Future<T> |
|
submit(java.lang.Runnable task,
T result)
|
| Methods inherited from class java.util.concurrent.ThreadPoolExecutor |
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, 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, terminated |
| Methods inherited from class java.util.concurrent.AbstractExecutorService |
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ERXTaskThreadPoolExecutor
public ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
ERXTaskThreadPoolExecutor
public ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.ThreadFactory threadFactory)
ERXTaskThreadPoolExecutor
public ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.RejectedExecutionHandler handler)
ERXTaskThreadPoolExecutor
public ERXTaskThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.ThreadFactory threadFactory,
java.util.concurrent.RejectedExecutionHandler handler)
submit
public java.util.concurrent.Future<?> submit(java.lang.Runnable task)
- Specified by:
submit in interface java.util.concurrent.ExecutorService- Overrides:
submit in class java.util.concurrent.AbstractExecutorService
submit
public <T> java.util.concurrent.Future<T> submit(java.lang.Runnable task,
T result)
- Specified by:
submit in interface java.util.concurrent.ExecutorService- Overrides:
submit in class java.util.concurrent.AbstractExecutorService
submit
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
- Specified by:
submit in interface java.util.concurrent.ExecutorService- Overrides:
submit in class java.util.concurrent.AbstractExecutorService
beforeExecute
protected void beforeExecute(java.lang.Thread t,
java.lang.Runnable r)
- Overrides:
beforeExecute in class java.util.concurrent.ThreadPoolExecutor
afterExecute
protected void afterExecute(java.lang.Runnable r,
java.lang.Throwable t)
- Overrides:
afterExecute in class java.util.concurrent.ThreadPoolExecutor
Copyright © 2002 – 2007 Project Wonder.