Package org.jgroups.util
Class ThreadPool
- java.lang.Object
-
- org.jgroups.util.ThreadPool
-
public class ThreadPool extends java.lang.ObjectMaintains 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 casenullis 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.- Author:
- Bela Ban
- To do:
- Shrink thread pool if threads are unused after some configurable time.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.commons.logging.Loglog
-
Constructor Summary
Constructors Constructor Description ThreadPool(int max_num)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()ReusableThreadgetThread()java.lang.StringtoString()
-
-
-
Method Detail
-
getThread
public ReusableThread getThread()
-
destroy
public void destroy()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-