org.gjt.sp.util
Class WorkThreadPool

java.lang.Object
  extended byorg.gjt.sp.util.WorkThreadPool

public class WorkThreadPool
extends java.lang.Object

A pool of work threads.

Since:
jEdit 2.6pre1
Version:
$Id: WorkThreadPool.java,v 1.8 2004/05/29 01:55:26 spestov Exp $
Author:
Slava Pestov
See Also:
WorkThread

Constructor Summary
WorkThreadPool(java.lang.String name, int count)
          Creates a new work thread pool with the specified number of work threads.
 
Method Summary
 void addProgressListener(WorkThreadProgressListener listener)
          Adds a progress listener to this thread pool.
 void addWorkRequest(java.lang.Runnable run, boolean inAWT)
          Adds a work request to the queue.
 int getRequestCount()
          Returns the number of pending requests.
 WorkThread getThread(int index)
          Returns the specified thread.
 int getThreadCount()
          Returns the number of threads in this pool.
 void removeProgressListener(WorkThreadProgressListener listener)
          Removes a progress listener from this thread pool.
 void start()
          Starts all the threads in this thread pool.
 void waitForRequests()
          Waits until all requests are complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkThreadPool

public WorkThreadPool(java.lang.String name,
                      int count)
Creates a new work thread pool with the specified number of work threads.

Parameters:
name - The thread name prefix
count - The number of work threads
Method Detail

start

public void start()
Starts all the threads in this thread pool.


addWorkRequest

public void addWorkRequest(java.lang.Runnable run,
                           boolean inAWT)
Adds a work request to the queue.

Parameters:
run - The runnable
inAWT - If true, will be executed in AWT thread. Otherwise, will be executed in work thread

waitForRequests

public void waitForRequests()
Waits until all requests are complete.


getRequestCount

public int getRequestCount()
Returns the number of pending requests.


getThreadCount

public int getThreadCount()
Returns the number of threads in this pool.


getThread

public WorkThread getThread(int index)
Returns the specified thread.

Parameters:
index - The index of the thread

addProgressListener

public void addProgressListener(WorkThreadProgressListener listener)
Adds a progress listener to this thread pool.

Parameters:
listener - The listener

removeProgressListener

public void removeProgressListener(WorkThreadProgressListener listener)
Removes a progress listener from this thread pool.

Parameters:
listener - The listener