org.javagroups.util
Class ThreadPool

java.lang.Object
  extended byorg.javagroups.util.ThreadPool

public class ThreadPool
extends java.lang.Object

Maintains a set of ReusableThreads. When a thread is to be returned, all existing threads are checked: when one is available, it will be returned. Otherwise, a new thread is created and returned, unless the pool limit is reached, in which case null is returned. Creates threads only as needed, up to the MAX_NUM limit. However, does not shrink the pool when more threads become available than are used. todo: Shrink thread pool if threads are unused after some configurable time

Author:
Bela Ban

Constructor Summary
ThreadPool(int max_num)
           
 
Method Summary
 void destroy()
           
 ReusableThread getThread()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool(int max_num)
Method Detail

getThread

public ReusableThread getThread()

destroy

public void destroy()

toString

public java.lang.String toString()


Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.