hypercast
Class FSMPool

java.lang.Object
  |
  +--hypercast.ObjectPool
        |
        +--hypercast.FSMPool

public class FSMPool
extends ObjectPool

This class defines a FSM instance pool which is built when the MessageStore is instantialized. The MessageStore creates instances for each type FSM with the amount specified in the configuration file. These pre-allocated FSM instances are used when a new FSM message is received by the MessageStore and a new FSM is needed. Using pre-allocated FSMs instead of creating a new FSM instance on fly for a new FSM message aims at reducing the processing time of each new FSM message. By default, there is no limit on the amount of FSM instances with certain type that can be stored in the pool.


Constructor Summary
FSMPool()
          Constructor.
 
Method Summary
 void addFSMInstance(java.lang.Object fsmInstance, short fsmid)
          Add a FSM instance with specified FSM id to the pool.
 void addFSMVector(java.util.Vector v, short fsmid)
          Add a vector of FSM instances with specified FSM id to the pool.
 hypercast.I_MessageStoreFSM getFSMInstance(short fsmid)
          Return a FSM instances with specified FSM id from the pool.
 java.util.Vector getFSMVector(short fsmid)
          Get the vector of FSM instances with specified FSM id in the pool.
 int getMaxNumOfFSMInstances(short fsmid)
          Get the maximum number of a certain type FSM instances that the pool can store.
 void setMaxNumOfFSMInstances(short fsmid, int num)
          Set the maximum number of a certain type FSM instances that the pool can store.
 
Methods inherited from class hypercast.ObjectPool
addObjInstance, addObjVector, getMaxNumOfObjInstances, getObjInstance, getObjVector, setMaxNumOfObjInstances
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSMPool

public FSMPool()
Constructor.

Method Detail

addFSMVector

public void addFSMVector(java.util.Vector v,
                         short fsmid)
Add a vector of FSM instances with specified FSM id to the pool.


getFSMVector

public java.util.Vector getFSMVector(short fsmid)
Get the vector of FSM instances with specified FSM id in the pool.


addFSMInstance

public void addFSMInstance(java.lang.Object fsmInstance,
                           short fsmid)
Add a FSM instance with specified FSM id to the pool.


getFSMInstance

public hypercast.I_MessageStoreFSM getFSMInstance(short fsmid)
Return a FSM instances with specified FSM id from the pool. If no required FSM instance is found, return null.


setMaxNumOfFSMInstances

public void setMaxNumOfFSMInstances(short fsmid,
                                    int num)
Set the maximum number of a certain type FSM instances that the pool can store.


getMaxNumOfFSMInstances

public int getMaxNumOfFSMInstances(short fsmid)
Get the maximum number of a certain type FSM instances that the pool can store.