ParamType - ResultType - public class ObservableCommandWrapper<ParamType,ResultType> extends Object implements AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
<IntermediateResultType> |
addIntermediateResponseObserver(@NonNull StreamObserver<IntermediateResultType> streamObserver)
Add an intermediate response observer
|
void |
addStateObserver(@NonNull StreamObserver<SiLAFramework.ExecutionInfo> streamObserver)
Add a command state observer
|
ResultType |
call()
Wrapps the command task with appropriate state notifications
|
void |
close()
Dispose all resources owned by the wrapper
|
SiLAFramework.CommandConfirmation |
getCommandConfirmation()
Retrieving Initial Command Confirmation
|
boolean |
isDone()
Return whether or not the command is done
|
<IntermediateResultType> |
notifyIntermediateResponse(IntermediateResultType intermediateResponse)
Notify intermediate response observers an intermediate response
|
void |
sendResult(@NonNull StreamObserver<ResultType> streamObserver)
Send command result to an observer or an error if command execution was not successful
|
void |
setExecutionInfoAndNotify(double progressionPercent,
Duration estimatedRemainingTime)
Set the execution information and notify observers
|
public SiLAFramework.CommandConfirmation getCommandConfirmation()
public ResultType call() throws StatusRuntimeException
StatusRuntimeExceptionpublic void addStateObserver(@NonNull @NonNull StreamObserver<SiLAFramework.ExecutionInfo> streamObserver)
streamObserver - The observerpublic <IntermediateResultType> void addIntermediateResponseObserver(@NonNull @NonNull StreamObserver<IntermediateResultType> streamObserver)
streamObserver - The observerpublic void sendResult(@NonNull @NonNull StreamObserver<ResultType> streamObserver)
streamObserver - the observerpublic <IntermediateResultType> void notifyIntermediateResponse(@NonNull IntermediateResultType intermediateResponse)
intermediateResponse - The intermediate response to notifypublic void close()
close in interface AutoCloseablepublic boolean isDone()
Copyright © 2022 SiLA Java Developers. All rights reserved.