All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

final class  pj_ThreadPool
     extends java.lang.Object
     implements java.lang.Runnable
{
          // Fields 4
     private final Object bufferQLock;
     private pj_BufferHandle bufferQueue;
     private boolean destroyed;
     private final pj_Flow flow;

          // Constructors 1
     pj_ThreadPool(pj_Flow, pj_ThreadPoolSpec);

          // Methods 8
     void addWork(pj_BufferHandle);
     pj_BufferHandle dequeueWorkItem();
     void destroy();
     boolean destroyed();
     pj_Flow native_getFlow();
     public void run();
     void signalWorkers();
     void threadStart(Runnable, String);
}

NodeOS ThreadPool implementation in Java.

Author:
Janos Ministry of Development


  Cross Reference

Returned By:
pj_Flow.getThreadPool()





  Fields

· bufferQLock

Summary  |  Top
   private final Object bufferQLock

Lock protecting the queue of WorkItems.


· bufferQueue

Summary  |  Top
   private pj_BufferHandle bufferQueue

Queued buffers (waiting for a thread to handle them) are stored here.


· flow

Summary  |  Top
   private final pj_Flow flow

The flow this ThreadPool is associated with.


· destroyed

Summary  |  Top
   private boolean destroyed


  Constructors

· pj_ThreadPool

Summary  |  Top

   pj_ThreadPool(pj_Flow flow, 
                 pj_ThreadPoolSpec tpspec) 

Create a new pj_ThreadPool.

The variousSchedulerParameters and scheduler parameters hardly even qualify as hacks.



  Methods

· threadStart

Summary  |  Top
   void threadStart(Runnable runnable, 
                    String name) 

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

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



· native_getFlow

Summary  |  Top
   pj_Flow native_getFlow() 

Return the pj_Flow this ThreadPool is associated with.



· destroy

Summary  |  Top
   void destroy() 

Destroy this pj_ThreadPool.

XXX this is a hack.



· destroyed

Summary  |  Top
   boolean destroyed() 


· addWork

Summary  |  Top
   void addWork(pj_BufferHandle bh) 

Add a Buffer to the pj_ThreadPool's Buffer list.

The buffer must not be on some other list (either an InChannel list, OutChannel list, or some bufferQueue).



· dequeueWorkItem

Summary  |  Top
   pj_BufferHandle dequeueWorkItem() 


· signalWorkers

Summary  |  Top
   void signalWorkers() 


· run

Summary  |  Top
   public void run() 

Do the work on this pj_ThreadPool.

This function won't return until the ThreadPool is destroyed.

Implements:
run in interface Runnable


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