Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ssttr.util.processor
Class PoolProcessor  view PoolProcessor download PoolProcessor.java

java.lang.Object
  extended bycom.ssttr.util.processor.AbstractProcessor
      extended bycom.ssttr.util.processor.PoolProcessor
All Implemented Interfaces:
Processor

public class PoolProcessor
extends AbstractProcessor
implements Processor

A PoolProcessor has a fixed number of task processors available. If the pool is full, then no more tasks can be processed untill another task is finished and leaves.


Nested Class Summary
protected  class AbstractProcessor.ProcessorThread
           
 
Field Summary
protected  int aliveProcessors
           
protected  int maxProcessors
           
protected  int numProcessors
           
protected  java.util.Vector processQueue
           
protected  int runningProcessors
           
 
Constructor Summary
PoolProcessor()
          Creates a new instance of PoolProcessor with a poolSize of 10
PoolProcessor(int poolSize)
          Creates a new instance of PoolProcessor
 
Method Summary
protected  void addAProcessor()
           
 int getMaxTasks()
          Gets the maximum number of tasks this processor will run at a time.
 int getMinTasks()
          Not used in this Processor
 int getQueuedTasks()
          Gets the number of currently queued tasks.
 int getQueueSize()
          Not used in this Processor
 int getRunningTasks()
          Gets the number of currently running tasks.
 java.lang.Runnable getTask()
           
protected  void killAProcessor()
           
 boolean process(java.lang.Runnable task)
          Processes the given task.
 void setMaxTasks(int maxTasks)
          Sets the maximum number of tasks this processor will run at a time.
 void setMinTasks(int minTasks)
          Not used in this Processor
 void setQueueSize(int queueSize)
          Not used in this Processor
 boolean shutdown()
          Shuts down the Processor without waiting for the individual processors to stop.
 boolean shutdown(int maxWait)
          Shuts down the Processor and waits for all processors to stop.
 void startup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ssttr.util.processor.Processor
getQueuedTasks, getRunningTasks, shutdown, shutdown, startup
 

Field Detail

maxProcessors

protected int maxProcessors

numProcessors

protected int numProcessors

aliveProcessors

protected int aliveProcessors

runningProcessors

protected int runningProcessors

processQueue

protected java.util.Vector processQueue
Constructor Detail

PoolProcessor

public PoolProcessor()
Creates a new instance of PoolProcessor with a poolSize of 10


PoolProcessor

public PoolProcessor(int poolSize)
Creates a new instance of PoolProcessor

Method Detail

process

public boolean process(java.lang.Runnable task)
Processes the given task.

Specified by:
process in interface Processor

setMaxTasks

public void setMaxTasks(int maxTasks)
Description copied from interface: Processor
Sets the maximum number of tasks this processor will run at a time.

Specified by:
setMaxTasks in interface Processor

getMaxTasks

public int getMaxTasks()
Description copied from interface: Processor
Gets the maximum number of tasks this processor will run at a time.

Specified by:
getMaxTasks in interface Processor

setMinTasks

public void setMinTasks(int minTasks)
Not used in this Processor

Specified by:
setMinTasks in interface Processor

getMinTasks

public int getMinTasks()
Not used in this Processor

Specified by:
getMinTasks in interface Processor

setQueueSize

public void setQueueSize(int queueSize)
Not used in this Processor

Specified by:
setQueueSize in interface Processor

getQueueSize

public int getQueueSize()
Not used in this Processor

Specified by:
getQueueSize in interface Processor

startup

public void startup()
Specified by:
startup in interface Processor

shutdown

public boolean shutdown()
Description copied from interface: Processor
Shuts down the Processor without waiting for the individual processors to stop.

Specified by:
shutdown in interface Processor

shutdown

public boolean shutdown(int maxWait)
Description copied from interface: Processor
Shuts down the Processor and waits for all processors to stop.

Specified by:
shutdown in interface Processor

getRunningTasks

public int getRunningTasks()
Description copied from interface: Processor
Gets the number of currently running tasks.

Specified by:
getRunningTasks in interface Processor

getQueuedTasks

public int getQueuedTasks()
Description copied from interface: Processor
Gets the number of currently queued tasks.

Specified by:
getQueuedTasks in interface Processor

addAProcessor

protected void addAProcessor()

killAProcessor

protected void killAProcessor()

getTask

public java.lang.Runnable getTask()