Luigi Homepage

net.cw.luigi.commands
Class WaitableResult

java.lang.Object
  extended by net.cw.luigi.commands.LateResultImpl
      extended by net.cw.luigi.commands.WaitableResult
All Implemented Interfaces:
Serializable, LateResult

public class WaitableResult
extends LateResultImpl

LateResult implementation that uses a Latch to allow client threads to wait until the worker thread is done. Note that waiting is done only throught the getOrThrow method, and instances of this class can still be used in polling techniques around the isReady() method.

Version:
$Revision: 1.1 $
Author:
Tiago Silveira
See Also:
Latch, Serialized Form

Constructor Summary
WaitableResult()
          Constructor for the WaitableResult object
 
Method Summary
 Object getOrThrow()
          acquires from the latch and calls getOrThrow in the superclass.
 void setError(Throwable error)
          Sets the error and releases the latch
 void setValue(Object value)
          Sets the value and releases the latch
 
Methods inherited from class net.cw.luigi.commands.LateResultImpl
getError, getValue, isError, isReady, isValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaitableResult

public WaitableResult()
Constructor for the WaitableResult object

Method Detail

getOrThrow

public Object getOrThrow()
                  throws Throwable
acquires from the latch and calls getOrThrow in the superclass.

Specified by:
getOrThrow in interface LateResult
Overrides:
getOrThrow in class LateResultImpl
Returns:
The or throw value
Throws:
Throwable - TODO: Description of the Exception

setValue

public void setValue(Object value)
Sets the value and releases the latch

Specified by:
setValue in interface LateResult
Overrides:
setValue in class LateResultImpl
Parameters:
value - The new value

setError

public void setError(Throwable error)
Sets the error and releases the latch

Specified by:
setError in interface LateResult
Overrides:
setError in class LateResultImpl
Parameters:
error - The new error

Luigi Homepage