uPortal 2.4.1
API Documentation

org.jasig.portal.utils.threading
Interface ThreadPool

All Known Implementing Classes:
AbstractPool

public interface ThreadPool

An interface for a generic pool of worker threads.

Version:
$Revision: 1.3 $
Author:
Method Summary
 int busyThreads()
          Gives the number of busy (working) worker threads in the pool
 void destroy()
          Destroys the pool and all it's threads.
 void destroyThread(java.lang.Thread thread)
          Destroys the pooled thread
 WorkTracker execute(WorkerTask task)
          Queues up a task to be executed.
 java.lang.Thread getPooledThread()
          Gets the pooled thread
 int idleThreads()
          Gives the number of idle threads in the pool
 void lockThread(java.lang.Thread thread)
          Locks the thread to the pool
 void releaseThread(java.lang.Thread thread)
          Release the thread to the pool
 int totalThreads()
          Gives the total number of threads in the pool
 

Method Detail

execute

public WorkTracker execute(WorkerTask task)
                    throws java.lang.IllegalStateException
Queues up a task to be executed. The queue use FIFO ordering.

Parameters:
task - the task to be executed
Returns:
the WorkerTracker for used to track and interact with this task
Throws:
java.lang.IllegalStateException - - thrown if the pool has been destroyed

totalThreads

public int totalThreads()
                 throws java.lang.IllegalStateException
Gives the total number of threads in the pool

Returns:
the total number of worker threads (busy and idle) in the pool
Throws:
java.lang.IllegalStateException

idleThreads

public int idleThreads()
                throws java.lang.IllegalStateException
Gives the number of idle threads in the pool

Returns:
the number of idle worker threads in the pool
Throws:
java.lang.IllegalStateException

busyThreads

public int busyThreads()
                throws java.lang.IllegalStateException
Gives the number of busy (working) worker threads in the pool

Returns:
the number of busy workers in the pool
Throws:
java.lang.IllegalStateException

releaseThread

public void releaseThread(java.lang.Thread thread)
                   throws java.lang.Exception
Release the thread to the pool

Throws:
java.lang.Exception

lockThread

public void lockThread(java.lang.Thread thread)
                throws java.lang.Exception
Locks the thread to the pool

Throws:
java.lang.Exception

getPooledThread

public java.lang.Thread getPooledThread()
                                 throws java.lang.Exception
Gets the pooled thread

Throws:
java.lang.Exception

destroyThread

public void destroyThread(java.lang.Thread thread)
Destroys the pooled thread


destroy

public void destroy()
Destroys the pool and all it's threads. A destroyed pool thread can not be used after is has been destroyed. Threads running when a pool is destroyed are interrupted and then destroyed.


uPortal 2.4.1
API Documentation