org.simantics.databoard.method
Class AsyncResultImpl
java.lang.Object
org.simantics.databoard.method.AsyncResultImpl
- All Implemented Interfaces:
- MethodInterface.AsyncResult
public class AsyncResultImpl
- extends java.lang.Object
- implements MethodInterface.AsyncResult
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AsyncResultImpl
public AsyncResultImpl()
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)