pingpong
Class PingPongComputation

java.lang.Object
  extended by pingpong.PingPongComputation
All Implemented Interfaces:
Computation, java.lang.Runnable

public class PingPongComputation
extends java.lang.Object
implements Computation

The PingPong computation is an example of how to implement a particular computation, and can be used as the basis for such. This computation does not do any meaningful work, besides generating {link PingPongWorkUnits}'s and collecting the returned {link PingPongResultUnit}'s. This computation allows the user to customize the many parameters, such as the size of the work unit, the size of the result unit, and how long should the {link PingPongWorker} wait before generating a result unit.
The parameters which can be used to modify the behaviour of this coputation are:

This computation can also be used to benchmark the SWC2 system.

Author:
Dino Klein
See Also:
PingPongResultUnit, PingPongWorkUnit, PingPongWorkUnit.WorkerDelay, PingPongWorker

Constructor Summary
PingPongComputation()
           
 
Method Summary
 void loadConfiguration(java.util.Map config, WorkQueueAccess wqa, java.io.OutputStream os)
          Invoked by the SWC2 system in order to initialize the computation with the user supplied parameters.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PingPongComputation

public PingPongComputation()
Method Detail

loadConfiguration

public void loadConfiguration(java.util.Map config,
                              WorkQueueAccess wqa,
                              java.io.OutputStream os)
                       throws java.lang.Exception
Description copied from interface: Computation
Invoked by the SWC2 system in order to initialize the computation with the user supplied parameters.

Specified by:
loadConfiguration in interface Computation
Parameters:
config - The key/value pairs passed as initialization values for the computation.
wqa - The object through which the computation will submit work units and collect result units.
os - An output stream opened by the swc2 system, to be used by the computation for any output.
Throws:
java.lang.Exception - Any exception during initialization will caught by the swc2 system and the computation will be terminated.
See Also:
WorkQueueAccess

run

public void run()
Specified by:
run in interface java.lang.Runnable