Class SendRequestHandle
java.lang.Object
com.inductiveautomation.ignition.common.script.message.SendRequestHandle
- All Implemented Interfaces:
MessageResultHandler,Request,RequestWatcher
This only exists because we want to hide the completion functions from the scripting system, so
we break it out to a different interface (MessageResultHandler).
A handle to an asynchronous request that allows for blocking, cancellation, and result handling via callbacks.
-
Constructor Summary
ConstructorsConstructorDescriptionSendRequestHandle(int timeout) SendRequestHandle(CompletableFuture<Object> future) -
Method Summary
Modifier and TypeMethodDescriptionbooleanblock()Blocks until the request is complete.voidcancel()Cancels the request.compose(RequestWatcher... requestWatchers) Composes this request with others into a single watcher.voidCalled when the request fails with an error.get()Blocks until the request is complete and returns the result.getError()Returns the error that occurred during request execution, if any.voidonError(org.python.core.PyObject func) Registers a callback to be executed when the request fails.voidonSuccess(org.python.core.PyObject func) Registers a callback to be executed when the request completes successfully.voidCalled when the request completes successfully.toString()
-
Constructor Details
-
SendRequestHandle
-
SendRequestHandle
public SendRequestHandle(int timeout)
-
-
Method Details
-
block
public boolean block()Description copied from interface:RequestWatcherBlocks until the request is complete.- Specified by:
blockin interfaceRequestWatcher- Returns:
trueif the request completed successfully,falseif it failed or was cancelled.
-
errorResult
Description copied from interface:MessageResultHandlerCalled when the request fails with an error.- Specified by:
errorResultin interfaceMessageResultHandler- Parameters:
e- The exception that occurred.
-
successResult
Description copied from interface:MessageResultHandlerCalled when the request completes successfully.- Specified by:
successResultin interfaceMessageResultHandler- Parameters:
v- The result of the request.
-
get
Description copied from interface:RequestBlocks until the request is complete and returns the result. -
cancel
public void cancel()Description copied from interface:RequestCancels the request. -
getError
Description copied from interface:RequestReturns the error that occurred during request execution, if any. -
onSuccess
public void onSuccess(org.python.core.PyObject func) Description copied from interface:RequestRegisters a callback to be executed when the request completes successfully. -
onError
public void onError(org.python.core.PyObject func) Description copied from interface:RequestRegisters a callback to be executed when the request fails. -
compose
Description copied from interface:RequestWatcherComposes this request with others into a single watcher.- Specified by:
composein interfaceRequestWatcher- Parameters:
requestWatchers- The other watchers to compose with.- Returns:
- A new
RequestWatcherthat tracks all provided requests.
-
toString
-