Class TransportFilter.QueuingExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.glassfish.jersey.jdk.connector.internal.TransportFilter.QueuingExecutor
- All Implemented Interfaces:
AutoCloseable
,Executor
,ExecutorService
- Enclosing class:
TransportFilter
A thread pool executor that prefers creating new worker threads over queueing tasks until the maximum poll size
has been reached, after which it will start queueing tasks.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Synchronous queue that tries to emptyTransportFilter.QueuingExecutor.HandOffQueue.taskQueue
before it blocks waiting for new tasks to be submitted.Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
-
Constructor Summary
ConstructorsConstructorDescriptionQueuingExecutor
(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, Queue<Runnable> taskQueue, boolean threadSafeQueue, ThreadFactory threadFactory) Constructor. -
Method Summary
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, 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
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ExecutorService
close
-
Field Details
-
taskQueue
-
threadSafeQueue
private final boolean threadSafeQueue
-
-
Constructor Details
-
QueuingExecutor
QueuingExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, Queue<Runnable> taskQueue, boolean threadSafeQueue, ThreadFactory threadFactory) Constructor.- Parameters:
threadSafeQueue
- indicates iftaskQueue
is thread safe or not.
-
-
Method Details
-
execute
Submit a task for execution, if the maximum thread limit has been reached and all the threads are occupied, enqueue the task. The task is not executed by the current thread, but by a thread from the thread pool.- Specified by:
execute
in interfaceExecutor
- Overrides:
execute
in classThreadPoolExecutor
- Parameters:
task
- to be executed.
-