net.sourceforge.cvsgrab.util
Class ThreadPool

java.lang.Object
  extended by net.sourceforge.cvsgrab.util.ThreadPool

public class ThreadPool
extends Object

Simple fized sized Thread Pool


Constructor Summary
ThreadPool(int max)
          Create a thread pool with max number of threads
 
Method Summary
 void destroy()
          Interrupt all threads and clear the pool This method should only be used to tidy up.
 void doTask(Runnable task)
          Execute a Runnable task
static ThreadPool getInstance()
           
protected  List getPool()
          Gets the pool.
static void init(int maxThreads)
          Initialise the thread pool
protected  boolean isStopped()
          Gets the stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool(int max)
Create a thread pool with max number of threads

Method Detail

init

public static void init(int maxThreads)
Initialise the thread pool

Parameters:
maxThreads - The max number of threads

getInstance

public static ThreadPool getInstance()
Returns:
the singleton instance of the thread pool

destroy

public void destroy()
Interrupt all threads and clear the pool This method should only be used to tidy up. The ThreadPool should not be used after invoking this method


doTask

public void doTask(Runnable task)
Execute a Runnable task


getPool

protected List getPool()
Gets the pool.

Returns:
the pool.

isStopped

protected boolean isStopped()
Gets the stopped.

Returns:
the stopped.


Copyright © 2002-2005 Ludovic Claude. All Rights Reserved.