com.wowza.wms.vhost
Class ThreadPool

Object
  extended by com.wowza.wms.vhost.ThreadPool

public class ThreadPool
extends Object

ThreadPool: class for managing a pool of threads.


Constructor Summary
ThreadPool(IVHost vhost, String name)
          Create a new thread pool attached to a vHost.
 
Method Summary
 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.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool(IVHost vhost,
                  String name)
Create a new thread pool attached to a vHost.

Parameters:
vhost - vHost
Method Detail

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 -

getActiveCount

public int getActiveCount()
Get number of active threads.

Returns:
number of active threads

getExecutor

public java.util.concurrent.Executor getExecutor()
Get the underlying Executor pool.

Returns:
Executor pool

getQueueSize

public int getQueueSize()
Get the number of command objects in the LinkedBlockingQueue.

Returns:
number of command objects in the LinkedBlockingQueue

init

public void init(int corePoolSize)
Initialize threadPool.

Parameters:
corePoolSize - core pool size

terminate

public void terminate()
Terminate all threads and cleanup threadPool.