lima.distribution
Interface WorkUnit

All Known Implementing Classes:
CompositeWorkUnit, EcmWorkUnit, QSWorkUnit, TestWU

public interface WorkUnit

A WorkUnit is the basic thing that a client processes. It carries the data from client to server and from server to client. The lifecycle of a WorkUnit is thus:
WorkUnit is 'minted' by the Factorisation system.
Sent to distribute.server
Sent to client
client calls run()
client sends it the the server
server returns it to the client
Note that HOFunctions.map may be used to create the WorkUnits. WorkUnits deal with common data themselves.


Method Summary
 int cost()
          Guess how long this workunit will take to run, in ms on a midrange machine
 void generateHashCode()
          WHAT DOES THIS DO? WHY? - pw
 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.
 

Method Detail

run

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


cost

public int cost()
Guess how long this workunit will take to run, in ms on a midrange machine


runtime

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

Returns:
int
Throws:
java.lang.IllegalStateException - iff run has not been called.

hasRun

public boolean hasRun()
Returns true iff run has completed on this workUnit.

Returns:
boolean

generateHashCode

public void generateHashCode()
WHAT DOES THIS DO? WHY? - pw