org.simantics.databoard.method
Class AsyncResultImpl

java.lang.Object
  extended by org.simantics.databoard.method.AsyncResultImpl
All Implemented Interfaces:
MethodInterface.AsyncResult

public class AsyncResultImpl
extends java.lang.Object
implements MethodInterface.AsyncResult


Constructor Summary
AsyncResultImpl()
           
 
Method Summary
 java.lang.Object getExecutionError()
           
 InvokeException getInvokeException()
           
 java.lang.Object getResponse()
           
 MethodInterface.AsyncRequestStatus getStatus()
           
 void setErrorAdapter(Adapter errorAdapter)
           
 void setExecutionError(java.lang.Object executionError)
           
 void setInvokeException(InvokeException error)
           
 void setListener(MethodInterface.InvokeListener listener)
          Add a listener.
 void setResponse(java.lang.Object response)
           
 void setResponseAdapter(Adapter responseAdapter)
           
 java.lang.Object waitForResponse()
           
 java.lang.Object waitForResponse(long timeout, java.util.concurrent.TimeUnit unit)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncResultImpl

public AsyncResultImpl()
Method Detail

getExecutionError

public java.lang.Object getExecutionError()
Specified by:
getExecutionError in interface MethodInterface.AsyncResult

getInvokeException

public InvokeException getInvokeException()
Specified by:
getInvokeException in interface MethodInterface.AsyncResult

setInvokeException

public void setInvokeException(InvokeException error)

setResponse

public void setResponse(java.lang.Object response)

setExecutionError

public void setExecutionError(java.lang.Object executionError)

getResponse

public java.lang.Object getResponse()
Specified by:
getResponse in interface MethodInterface.AsyncResult
Returns:
response or null

getStatus

public MethodInterface.AsyncRequestStatus getStatus()
Specified by:
getStatus in interface MethodInterface.AsyncResult

setListener

public void setListener(MethodInterface.InvokeListener listener)
Description copied from interface: MethodInterface.AsyncResult
Add a listener. It will be notified immediately if the response is available.

Specified by:
setListener in interface MethodInterface.AsyncResult
Parameters:
listener - (listener may not block) or null to remove listener

waitForResponse

public java.lang.Object waitForResponse()
                                 throws InvokeException,
                                        MethodInterface.ExecutionError,
                                        java.lang.InterruptedException
Specified by:
waitForResponse in interface MethodInterface.AsyncResult
Returns:
response
Throws:
InvokeException - network error, e.g. IOException of MethodNotSupportedException
MethodInterface.ExecutionError - error that occured while executing the method
java.lang.InterruptedException - block was canceled

waitForResponse

public java.lang.Object waitForResponse(long timeout,
                                        java.util.concurrent.TimeUnit unit)
                                 throws InvokeException,
                                        MethodInterface.ExecutionError,
                                        java.lang.InterruptedException
Specified by:
waitForResponse in interface MethodInterface.AsyncResult
Returns:
response
Throws:
InvokeException - network error, e.g. IOException of MethodNotSupportedException
MethodInterface.ExecutionError - error that occured while executing the method
java.lang.InterruptedException

setResponseAdapter

public void setResponseAdapter(Adapter responseAdapter)

setErrorAdapter

public void setErrorAdapter(Adapter errorAdapter)