All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.nodeos.ThreadPool
java.lang.Object
   |
   +----edu.utah.janos.nodeos.ThreadPool

  Summary

public final class  ThreadPool
     extends java.lang.Object
{
          // Fields 5
     private boolean destroyed;
     private Flow flow;
     private WorkItem head;
     private WorkItem tail;
     private final Object workLock;

          // Constructors 1
     public ThreadPool(Flow, Object, ThreadScheduler);

          // Methods 9
     void addWork(WorkItem);
     WorkItem dequeueWorkItem();
     public void destroy();
     public boolean destroyed();
     void doWork();
     void enqueueWorkItem(WorkItem);
     public Flow getFlow();
     void signalWorkers();
     public Thread threadStart(Runnable);
}

ThreadPool wrapper for Java.

Author:
Janos Ministry of Development


  Cross Reference

Returned By:
Flow.threadPool()





  Fields

· workLock

Summary  |  Top
   private final Object workLock

Lock protecting the queue of WorkItems.


· head

Summary  |  Top
   private WorkItem head

WorkItems are added here.


· tail

Summary  |  Top
   private WorkItem tail

WorkItems are removed here.


· flow

Summary  |  Top
   private Flow flow


· destroyed

Summary  |  Top
   private boolean destroyed


  Constructors

· ThreadPool

Summary  |  Top

   public ThreadPool(Flow flow, 
                     Object variousSchedulerParameters, 
                     ThreadScheduler scheduler) 

Create a new ThreadPool.

The variousSchedulerParameters and scheduler parameters hardly even qualify as hacks.

XXX This should take a ThreadPoolSpec as a parameter.



  Methods

· threadStart

Summary  |  Top
   public Thread threadStart(Runnable r) 

Create an explicit thread and return that thread handle. This is a new thread which is not subject to whatever concurrency limit the ThreadPool has. But, it will be scheduled by the ThreadPool's scheduler.

Parameter Description
r the Runnable to start the target thread on.



· destroy

Summary  |  Top
   public void destroy() 

Destroy this ThreadPool.

XXX this is a hack.



· addWork

Summary  |  Top
   void addWork(WorkItem wi) 

Add a task to the ThreadPool's task list.

XXX what happens if the same WorkItem is enqueued more than once?



· getFlow

Summary  |  Top
   public Flow getFlow() 


· destroyed

Summary  |  Top
   public boolean destroyed() 


· enqueueWorkItem

Summary  |  Top
   void enqueueWorkItem(WorkItem wi) 


· dequeueWorkItem

Summary  |  Top
   WorkItem dequeueWorkItem() 


· signalWorkers

Summary  |  Top
   void signalWorkers() 


· doWork

Summary  |  Top
   void doWork() 

Do the work on this ThreadPool.

This function never returns.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7