org.ofbiz.service
Class GenericResultWaiter

java.lang.Object
  extended by org.ofbiz.service.GenericResultWaiter
All Implemented Interfaces:
java.io.Serializable, GenericRequester

public class GenericResultWaiter
extends java.lang.Object
implements GenericRequester

Generic Result Waiter Class

See Also:
Serialized Form

Field Summary
static java.lang.String module
           
static int SERVICE_FAILED
          Status code for a failed service
static int SERVICE_FINISHED
          Status code for a successful service
static int SERVICE_RUNNING
          Status code for a running service
 
Constructor Summary
GenericResultWaiter()
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getResult()
          Gets the results of the service or null if none
 java.lang.Throwable getThrowable()
          Returns the exception which was thrown or null if none
 boolean isCompleted()
          If the service has completed return true
 void receiveResult(java.util.Map<java.lang.String,java.lang.Object> result)
          Receive the result of an asynchronous service call
 void receiveThrowable(java.lang.Throwable t)
          Receive an exception (Throwable) from an asynchronous service cell
 int status()
          Returns the status of the service.
 java.util.Map<java.lang.String,java.lang.Object> waitForResult()
          Waits for the service to complete
 java.util.Map<java.lang.String,java.lang.Object> waitForResult(long milliseconds)
          Waits for the service to complete, check the status ever n milliseconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

SERVICE_RUNNING

public static final int SERVICE_RUNNING
Status code for a running service

See Also:
Constant Field Values

SERVICE_FAILED

public static final int SERVICE_FAILED
Status code for a failed service

See Also:
Constant Field Values

SERVICE_FINISHED

public static final int SERVICE_FINISHED
Status code for a successful service

See Also:
Constant Field Values
Constructor Detail

GenericResultWaiter

public GenericResultWaiter()
Method Detail

receiveResult

public void receiveResult(java.util.Map<java.lang.String,java.lang.Object> result)
Description copied from interface: GenericRequester
Receive the result of an asynchronous service call

Specified by:
receiveResult in interface GenericRequester
Parameters:
result - Map of name, value pairs composing the result
See Also:
GenericRequester.receiveResult(java.util.Map)

receiveThrowable

public void receiveThrowable(java.lang.Throwable t)
Description copied from interface: GenericRequester
Receive an exception (Throwable) from an asynchronous service cell

Specified by:
receiveThrowable in interface GenericRequester
Parameters:
t - The Throwable which was received
See Also:
GenericRequester.receiveThrowable(java.lang.Throwable)

status

public int status()
Returns the status of the service.

Returns:
int Status code

isCompleted

public boolean isCompleted()
If the service has completed return true

Returns:
boolean

getThrowable

public java.lang.Throwable getThrowable()
Returns the exception which was thrown or null if none

Returns:
Exception

getResult

public java.util.Map<java.lang.String,java.lang.Object> getResult()
Gets the results of the service or null if none

Returns:
Map

waitForResult

public java.util.Map<java.lang.String,java.lang.Object> waitForResult()
Waits for the service to complete

Returns:
Map

waitForResult

public java.util.Map<java.lang.String,java.lang.Object> waitForResult(long milliseconds)
Waits for the service to complete, check the status ever n milliseconds

Parameters:
milliseconds -
Returns:
Map