lima.distribution
Class CompositeWorkUnit

java.lang.Object
  |
  +--lima.observation.ObservableBase
        |
        +--lima.distribution.CompositeWorkUnit
All Implemented Interfaces:
Observable, java.io.Serializable, WorkUnit

public class CompositeWorkUnit
extends ObservableBase
implements WorkUnit, java.io.Serializable

CompositeWorkUnit is a type of workunit that processes its member workunits serially. It reduces network issues with small workunits.
STATUS: Written, not tested - pw

See Also:
Serialized Form

Nested Class Summary
 class CompositeWorkUnit.ProgressEvent
           
 
Field Summary
 int mynum
           
 
Constructor Summary
CompositeWorkUnit(lima.distribution.WorkUnit[] members)
          Create a workUnit that will process all of members.
 
Method Summary
 int cost()
          Guess how long this workunit will take to run, in ms on a midrange machine
 boolean equals(java.lang.Object o)
           
 void generateHashCode()
          WHAT DOES THIS DO? WHY? - pw
 lima.distribution.WorkUnit[] getMembers()
          Gets all the workunits that this workunit will/has processed.
 int hashcode()
           
 boolean hasRun()
          Returns true iff run has completed on this workUnit.
 void run(lima.storage.Cache c)
          Start processing this WorkUnit.
 int runtime()
          How long this WorkUnit took to run in ms.
 java.lang.String toString()
           
 
Methods inherited from class lima.observation.ObservableBase
clearObservers, notifyObservers, registerObserver, unregisterObserver
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mynum

public final int mynum
Constructor Detail

CompositeWorkUnit

public CompositeWorkUnit(lima.distribution.WorkUnit[] members)
Create a workUnit that will process all of members.

Parameters:
members - - The workUnits to process.
Method Detail

generateHashCode

public void generateHashCode()
Description copied from interface: WorkUnit
WHAT DOES THIS DO? WHY? - pw

Specified by:
generateHashCode in interface WorkUnit

run

public void run(lima.storage.Cache c)
Description copied from interface: WorkUnit
Start processing this WorkUnit. This method MUST return only after processing has finished, and the WorkUnit can be send back to the server.

Specified by:
run in interface WorkUnit
See Also:
distribute.WorkUnit#run()

getMembers

public lima.distribution.WorkUnit[] getMembers()
Gets all the workunits that this workunit will/has processed.

Returns:
WorkUnit

cost

public int cost()
Description copied from interface: WorkUnit
Guess how long this workunit will take to run, in ms on a midrange machine

Specified by:
cost in interface WorkUnit
See Also:
distribute.WorkUnit#cost()

runtime

public int runtime()
            throws java.lang.IllegalStateException
Description copied from interface: WorkUnit
How long this WorkUnit took to run in ms. This should only be called after run has been called.

Specified by:
runtime in interface WorkUnit
Returns:
int
Throws:
java.lang.IllegalStateException - iff run has not been called.
See Also:
WorkUnit.runtime()

hasRun

public boolean hasRun()
Description copied from interface: WorkUnit
Returns true iff run has completed on this workUnit.

Specified by:
hasRun in interface WorkUnit
Returns:
boolean
See Also:
WorkUnit.hasRun()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashcode

public int hashcode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object