Klasse QueueingThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.jupnp.QueueingThreadPoolExecutor
- Alle implementierten Schnittstellen:
- Executor,- ExecutorService
This is a thread pool executor service, which works as a developer would expect it to work.
 The default 
ThreadPoolExecutor does the following (see
 the official
 JavaDoc):
 - If fewer than corePoolSize threads are running, the Executor always prefers adding a new thread rather than queuing.
- If corePoolSize or more threads are running, the Executor always prefers queuing a request rather than adding a new thread.
- If a request cannot be queued, a new thread is created unless this would exceed maximumPoolSize, in which case, the task will be rejected.
- corePoolSize is 1, so threads are only created on demand
- If the number of busy threads is smaller than the threadPoolSize, the Executor always prefers adding (or reusing) a thread rather than queuing it.
- If threadPoolSize threads are busy, new requests will be put in a FIFO queue and processed as soon as a thread becomes idle.
- The queue size is unbound, i.e. requests will never be rejected.
- Threads are terminated after being idle for at least 10 seconds.
- Autor:
- Kai Kreuzer - Initial contribution and API
- 
Verschachtelte Klassen - ÜbersichtVon Klasse geerbte verschachtelte Klassen/Schnittstellen java.util.concurrent.ThreadPoolExecutorThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
- 
KonstruktorübersichtKonstruktorenModifiziererKonstruktorBeschreibungprotectedQueueingThreadPoolExecutor(String name, int threadPoolSize) Allows to subclass QueueingThreadPoolExecutor.
- 
MethodenübersichtModifizierer und TypMethodeBeschreibungprotected voidaddToQueue(Runnable runnable) Adds a new task to the queueprotected voidafterExecute(Runnable r, Throwable t) static QueueingThreadPoolExecutorcreateInstance(String name, int threadPoolSize) Creates a new instance ofQueueingThreadPoolExecutorstatic QueueingThreadPoolExecutorcreateInstance(String name, int threadPoolSize, BlockingQueue<Runnable> taskQueue) Creates a new instance ofQueueingThreadPoolExecutorvoidgetQueue()voidThis implementation does not allow setting a custom handler.Von Klasse geerbte Methoden java.util.concurrent.ThreadPoolExecutorallowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setThreadFactory, shutdown, shutdownNow, terminated, toStringVon Klasse geerbte Methoden java.util.concurrent.AbstractExecutorServiceinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
- 
Konstruktordetails- 
QueueingThreadPoolExecutorAllows to subclass QueueingThreadPoolExecutor.
 
- 
- 
Methodendetails- 
createInstanceCreates a new instance ofQueueingThreadPoolExecutor- Parameter:
- name- the name of the thread pool, will be used as a prefix for the name of the threads
- threadPoolSize- the maximum size of the pool
- Gibt zurück:
- the QueueingThreadPoolExecutorinstance
 
- 
createInstancepublic static QueueingThreadPoolExecutor createInstance(String name, int threadPoolSize, BlockingQueue<Runnable> taskQueue) Creates a new instance ofQueueingThreadPoolExecutor- Parameter:
- name- the name of the thread pool, will be used as a prefix for the name of the threads
- threadPoolSize- the maximum size of the pool
- taskQueue- the task queue to use
- Gibt zurück:
- the QueueingThreadPoolExecutorinstance
 
- 
addToQueueAdds a new task to the queue- Parameter:
- runnable- the task to add
 
- 
afterExecute- Setzt außer Kraft:
- afterExecutein Klasse- ThreadPoolExecutor
 
- 
setRejectedExecutionHandlerThis implementation does not allow setting a custom handler.- Setzt außer Kraft:
- setRejectedExecutionHandlerin Klasse- ThreadPoolExecutor
- Löst aus:
- UnsupportedOperationException- if called.
 
- 
getQueue- Setzt außer Kraft:
- getQueuein Klasse- ThreadPoolExecutor
 
- 
execute- Angegeben von:
- executein Schnittstelle- Executor
- Setzt außer Kraft:
- executein Klasse- ThreadPoolExecutor
 
 
-