All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

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

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

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

ThreadPool wrapper for Java.


  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


  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.



· 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() 


· livePool

Summary  |  Top
   boolean livePool() 


· 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