org.locomotive.server
Class ThreadPoolManager

java.lang.Object
  |
  +--org.locomotive.server.ThreadPoolManager

public class ThreadPoolManager
extends java.lang.Object
implements LocomotiveService


Constructor Summary
ThreadPoolManager()
          Default constructor for the thread pool manager.
ThreadPoolManager(Log lg, int min, int max)
           
 
Method Summary
 int getActiveCount()
           
 int getMaxCount()
           
 int getMaxThreads()
          Get the maximum number of threads for this pool.
 int getMinCount()
           
 int getMinThreads()
          Get the minimum number of threads for this pool.
 PooledThread getPooledThread()
           
 int getPoolSize()
           
 boolean isRunning()
          Check if the service running.
 void returnToPool(PooledThread pt)
           
 void setLog(Log log)
          Set the server log for this pool.
 void setMaxThreads(int maxThreads)
          Set the maximum number of threads this pool can have.
 void setMinThreads(int minThreads)
          Set the minimum number of threads this pool can have.
 void startService()
          Start the thread pool manager.
 void stopService()
          Stop the thread pool manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPoolManager

public ThreadPoolManager(Log lg,
                         int min,
                         int max)

ThreadPoolManager

public ThreadPoolManager()
Default constructor for the thread pool manager.
Method Detail

startService

public void startService()
                  throws ServiceException
Start the thread pool manager.
Specified by:
startService in interface LocomotiveService
Throws:
ServiceException - is thrown if the manager could not start.

stopService

public void stopService()
                 throws ServiceException
Stop the thread pool manager.
Specified by:
stopService in interface LocomotiveService
Throws:
ServiceException - is thrown if the manager could not stop.

isRunning

public boolean isRunning()
Check if the service running.
Specified by:
isRunning in interface LocomotiveService
Returns:
Returns true if the service is running, false otherwise.

getPooledThread

public PooledThread getPooledThread()

returnToPool

public void returnToPool(PooledThread pt)

getActiveCount

public int getActiveCount()

getPoolSize

public int getPoolSize()

getMaxCount

public int getMaxCount()

getMinCount

public int getMinCount()

setMaxThreads

public void setMaxThreads(int maxThreads)
Set the maximum number of threads this pool can have.
Parameters:
maxThreads - Maximum number of threads for this pool.

getMaxThreads

public int getMaxThreads()
Get the maximum number of threads for this pool.
Returns:
Returns the maximum number of threads for this pool.

setMinThreads

public void setMinThreads(int minThreads)
Set the minimum number of threads this pool can have.
Parameters:
minThreads - Minimum number of threads for this pool.

getMinThreads

public int getMinThreads()
Get the minimum number of threads for this pool.
Returns:
Returns the minimum number of threads for this pool.

setLog

public void setLog(Log log)
Set the server log for this pool.
Parameters:
log - the log