rice.environment.processing
Class WorkRequest<R>

java.lang.Object
  extended by rice.environment.processing.WorkRequest<R>
All Implemented Interfaces:
Runnable, Cancellable

public abstract class WorkRequest<R>
extends Object
implements Runnable, Cancellable

Extend this class and implement doWork() if you need to do blocking disk IO. This is primarily used by Persistence.

Author:
Jeff Hoye

Field Summary
protected  boolean cancelled
           
protected  boolean running
           
 
Constructor Summary
WorkRequest()
           
WorkRequest(Continuation<R,Exception> c, SelectorManager sm)
           
 
Method Summary
 boolean cancel()
           
abstract  R doWork()
           
 void returnError(Exception e)
           
 void returnResult(R o)
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cancelled

protected boolean cancelled

running

protected boolean running
Constructor Detail

WorkRequest

public WorkRequest(Continuation<R,Exception> c,
                   SelectorManager sm)

WorkRequest

public WorkRequest()
Method Detail

returnResult

public void returnResult(R o)

returnError

public void returnError(Exception e)

run

public void run()
Specified by:
run in interface Runnable

cancel

public boolean cancel()
Specified by:
cancel in interface Cancellable
Returns:
true if it was cancelled, false if it was already complete, or cancelled.

doWork

public abstract R doWork()
                  throws Exception
Throws:
Exception


Copyright © 2010. All Rights Reserved.