@Named(value="threadpool") @ManagedAsyncExecutor public class VitamThreadPoolExecutor extends ThreadPoolExecutor implements org.eclipse.jetty.util.thread.ThreadPool, org.glassfish.jersey.spi.ExecutorServiceProvider
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
VitamThreadPoolExecutor()
Create a Cached Thread Pool
|
VitamThreadPoolExecutor(int minimumAvailableThreads)
Create a Cached Thread Pool
|
VitamThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> workQueue) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterExecute(Runnable r,
Throwable t)
CLean up the session inside the thread.
|
protected void |
beforeExecute(Thread t,
Runnable r)
Extract VitamSession from the given runnable, and sets it into the target (aka.
|
void |
dispose(ExecutorService executorService) |
void |
execute(Runnable command)
Pass the VitamSession through a VitamRunnable to the target Thread
|
static VitamThreadPoolExecutor |
getDefaultExecutor()
Default instance
|
ExecutorService |
getExecutorService() |
int |
getIdleThreads() |
int |
getThreads() |
boolean |
isLowOnThreads() |
void |
join() |
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
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
@Inject @Named(value="threadpool") public VitamThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue)
corePoolSize
- maximumPoolSize
- keepAliveTime
- unit
- workQueue
- @Inject @Named(value="threadpool") public VitamThreadPoolExecutor()
@Inject @Named(value="threadpool") public VitamThreadPoolExecutor(int minimumAvailableThreads)
minimumAvailableThreads
- minimum Available Threads kept in the poolpublic static VitamThreadPoolExecutor getDefaultExecutor()
public void execute(Runnable command)
execute
in interface Executor
execute
in class ThreadPoolExecutor
command
- protected void beforeExecute(Thread t, Runnable r)
Extract VitamSession from the given runnable, and sets it into the target (aka. current) Thread.
Carefully see ThreadPoolExecutor.beforeExecute(Thread, Runnable)
documentation, especially about the
thread executing this method.
beforeExecute
in class ThreadPoolExecutor
r
- Cf. ThreadPoolExecutor.beforeExecute(Thread, Runnable)
t
- Cf. ThreadPoolExecutor.beforeExecute(Thread, Runnable)
protected void afterExecute(Runnable r, Throwable t)
CLean up the session inside the thread.
Carefully see ThreadPoolExecutor.beforeExecute(Thread, Runnable)
documentation, especially about the
thread executing this method.
afterExecute
in class ThreadPoolExecutor
r
- Cf. ThreadPoolExecutor.beforeExecute(Thread, Runnable)
t
- Cf. ThreadPoolExecutor.beforeExecute(Thread, Runnable)
public void join() throws InterruptedException
join
in interface org.eclipse.jetty.util.thread.ThreadPool
InterruptedException
public int getThreads()
getThreads
in interface org.eclipse.jetty.util.thread.ThreadPool
public int getIdleThreads()
getIdleThreads
in interface org.eclipse.jetty.util.thread.ThreadPool
public boolean isLowOnThreads()
isLowOnThreads
in interface org.eclipse.jetty.util.thread.ThreadPool
public ExecutorService getExecutorService()
getExecutorService
in interface org.glassfish.jersey.spi.ExecutorServiceProvider
public void dispose(ExecutorService executorService)
dispose
in interface org.glassfish.jersey.spi.ExecutorServiceProvider
Copyright © 2018 Vitam. All rights reserved.