net.jxta.search.util
Class ThreadService
java.lang.Object
|
+--net.jxta.search.util.ThreadService
- public class ThreadService
- extends java.lang.Object
Constructor Summary |
ThreadService(int minThreadCount,
int maxThreadCount,
int threadIdleTimeout,
boolean traceRunExceptions,
boolean traceRunErrors)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThreadService
public ThreadService(int minThreadCount,
int maxThreadCount,
int threadIdleTimeout,
boolean traceRunExceptions,
boolean traceRunErrors)
getThread
public java.lang.Thread getThread(java.lang.Runnable target,
long timeout)
throws java.lang.InterruptedException,
java.lang.IllegalArgumentException
- Get a thread from the pool to power the given target.
- Parameters:
target
- The target Runnable to run.timeout
- The number of milliseconds to wait for a thread to
become available.- Throws:
java.lang.IllegalStateException
- If the thread pool is shutting down.- See Also:
com.sun.jes.service.thread.ThreadService#getThread
getThread
public java.lang.Thread getThread(java.lang.Runnable target)
throws java.lang.InterruptedException
- Blocking version of thread allocation.
- Parameters:
target
- The target object to run.- Returns:
- A thread instance or null.
- Throws:
java.lang.InterruptedException
- If the caller is interrupted, or
the thread service is uninstalled.
getAvailableThread
public java.lang.Thread getAvailableThread(java.lang.Runnable target)
throws java.lang.InterruptedException
- Get an available thread.
- Returns:
- A Thread, if one is available right away, or null
.
getRunningThreads
public int getRunningThreads()
getExistingThreads
public int getExistingThreads()
getMaxThreads
public int getMaxThreads()
getMinThreads
public int getMinThreads()