org.apache.nutch.util
Class ThreadPool

java.lang.Object
  extended byorg.apache.nutch.util.ThreadPool

public class ThreadPool
extends Object

ThreadPool.java ThreadPool maintains a large set of threads, which can be dedicated to a certain task, and then recycled.


Constructor Summary
ThreadPool(int numThreads)
          Creates a pool of numThreads size.
 
Method Summary
 void addJob(Runnable runnable)
          Post a Runnable to the queue.
 void shutdown()
          Turn off the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool(int numThreads)
Creates a pool of numThreads size. These threads sit around waiting for jobs to be posted to the list.

Method Detail

addJob

public void addJob(Runnable runnable)
Post a Runnable to the queue. This will be picked up by an active thread.


shutdown

public void shutdown()
Turn off the pool. Every thread, when finished with its current work, will realize that the pool is no longer running, and will exit.



Copyright © 2006 The Apache Software Foundation