bcds.phison.sim
Class PmDTypeReplicator<V,E>

java.lang.Object
  extended by bcds.phison.sim.PmBase<V,E>
      extended by bcds.phison.sim.PmDTypeReplicator<V,E>
All Implemented Interfaces:
ProcessingModule<V,E>, WithEnvParams

public class PmDTypeReplicator<V,E>
extends PmBase<V,E>
implements ProcessingModule<V,E>

Create new processing modules for each traffic type (rq.traf_type) and send the same received event to each of them. At shutdown, print a header per each traffic type and invoke the shutdown() method of the processing modules. The modules to be replicated are given in .modules. The special string "ALL" (case is ignored) signifies that all modules loaded at the time the first run() of module is executed, are replicated. The replicated modules are not inserted in the simulaator's list of modules. Instead, they are kept in a private list here and activated at each run(). The number of replicas depends on the number of distinct rq.traf_type processed, so the modules are instantiated as needed, over time. Exceptions: - This module (PmDTypeReplicator) is NEVER replicated to avoid recursion. - If at most one module exists, no replication is performed. - If at shutdown time, only one traf_type have been seen, no shutdown is invoked. This is to avoid duplicating any output produced by modules, because it is assumed that each instance processes its input in exactly the same way.


Constructor Summary
PmDTypeReplicator()
           
 
Method Summary
 java.lang.Object[] getEnvParams()
          Returns an empty array.
 void run(SimEvents evtype, ConnectionInfo<V,E> rq)
          Empty implementation.
 void shutdown()
          Empty implementation.
 
Methods inherited from class bcds.phison.sim.PmBase
ctx, env, getEnviron, getId, getName, opt, setup, sim, stats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bcds.phison.sim.ProcessingModule
getId, setup, sim
 
Methods inherited from interface bcds.phison.WithEnvParams
getEnviron, getName
 

Constructor Detail

PmDTypeReplicator

public PmDTypeReplicator()
Method Detail

run

public void run(SimEvents evtype,
                ConnectionInfo<V,E> rq)
Description copied from class: PmBase
Empty implementation.

Specified by:
run in interface ProcessingModule<V,E>
Overrides:
run in class PmBase<V,E>

shutdown

public void shutdown()
Description copied from class: PmBase
Empty implementation.

Specified by:
shutdown in interface ProcessingModule<V,E>
Overrides:
shutdown in class PmBase<V,E>

getEnvParams

public java.lang.Object[] getEnvParams()
Description copied from class: PmBase
Returns an empty array. This is the default implementation, suitable for modules that do not need additional environment parameters.

Specified by:
getEnvParams in interface WithEnvParams
Overrides:
getEnvParams in class PmBase<V,E>