Package com.wowza.wms.vhost
Class ThreadPool
Object
com.wowza.wms.vhost.ThreadPool
ThreadPool: class for managing a pool of threads.
-
Constructor Summary
ConstructorsConstructorDescriptionThreadPool
(IVHost vhost, String name) Create a new thread pool attached to a vHost. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Execute a runnable object.int
Get number of active threads.Get the underlying Executor pool.int
Get the number of command objects in the LinkedBlockingQueue.void
init
(int corePoolSize) Initialize threadPool.void
Terminate all threads and cleanup threadPool.
-
Constructor Details
-
ThreadPool
Create a new thread pool attached to a vHost.- Parameters:
vhost
- vHost
-
-
Method Details
-
init
public void init(int corePoolSize) Initialize threadPool.- Parameters:
corePoolSize
- core pool size
-
terminate
public void terminate()Terminate all threads and cleanup threadPool. -
execute
Execute a runnable object. If the threadPool is at the corePool size, the object will be added to a LinkedBlockingQueue in the order it was received.- Parameters:
command
-
-
getExecutor
Get the underlying Executor pool.- Returns:
- Executor pool
-
getActiveCount
public int getActiveCount()Get number of active threads.- Returns:
- number of active threads
-
getQueueSize
public int getQueueSize()Get the number of command objects in the LinkedBlockingQueue.- Returns:
- number of command objects in the LinkedBlockingQueue
-