Package com.wowza.wms.vhost
Class ThreadPool
- Object
-
- com.wowza.wms.vhost.ThreadPool
-
public class ThreadPool extends Object
ThreadPool: class for managing a pool of threads.
-
-
Constructor Summary
Constructors Constructor Description ThreadPool(IVHost vhost, String name)
Create a new thread pool attached to a vHost.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(Runnable command)
Execute a runnable object.int
getActiveCount()
Get number of active threads.java.util.concurrent.Executor
getExecutor()
Get the underlying Executor pool.int
getQueueSize()
Get the number of command objects in the LinkedBlockingQueue.void
init(int corePoolSize)
Initialize threadPool.void
terminate()
Terminate all threads and cleanup threadPool.
-
-
-
Constructor Detail
-
ThreadPool
public ThreadPool(IVHost vhost, String name)
Create a new thread pool attached to a vHost.- Parameters:
vhost
- vHost
-
-
Method Detail
-
init
public void init(int corePoolSize)
Initialize threadPool.- Parameters:
corePoolSize
- core pool size
-
terminate
public void terminate()
Terminate all threads and cleanup threadPool.
-
execute
public void execute(Runnable command)
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
public java.util.concurrent.Executor 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
-
-