Class FutureRpcResults.FutureRpcResultBuilder<I,O>
java.lang.Object
org.opendaylight.serviceutils.tools.rpc.FutureRpcResults.FutureRpcResultBuilder<I,O>
- Enclosing class:
FutureRpcResults
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.util.concurrent.ListenableFuture
<org.opendaylight.yangtools.yang.common.RpcResult<O>> build()
Builds the Future RpcResult.Sets a custom on-enter SLF4J logging level.Sets a custom on-failure action, for a given exception.Sets a custom on-failure SLF4J logging level, in case of an exception.Sets a custom on-success action, for a given output.Sets a custom on-success SLF4J logging level.withRpcErrorMessage
(Function<Throwable, String> newRpcErrorMessageFunction) Set a customRpcError
message function, for a given exception.
-
Method Details
-
build
@CheckReturnValue public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<O>> build()Builds the Future RpcResult.- Returns:
- Future RpcResult. Note that this will NEVER be a failed Future; any
errors are reported as !
RpcResult.isSuccessful()
, with details inRpcResult.getErrors()
, and not the Future itself.
-
onFailure
public FutureRpcResults.FutureRpcResultBuilder<I,O> onFailure(Consumer<Throwable> newOnFailureConsumer) Sets a custom on-failure action, for a given exception. -
onFailureLogLevel
public FutureRpcResults.FutureRpcResultBuilder<I,O> onFailureLogLevel(FutureRpcResults.LogLevel level) Sets a custom on-failure SLF4J logging level, in case of an exception. The log message mentions the RPC method name, the provided input, the exception and its stack trace (depending on logger settings). By default, it isLOG.error
. SettingNONE
will disable this logging. -
onSuccessLogLevel
public FutureRpcResults.FutureRpcResultBuilder<I,O> onSuccessLogLevel(FutureRpcResults.LogLevel level) Sets a custom on-success SLF4J logging level. The log message mentions the RPC method name, the provided input, and the resulting output. By default, it isLOG.debug
. SettingNONE
will disable this logging. -
onEnterLogLevel
public FutureRpcResults.FutureRpcResultBuilder<I,O> onEnterLogLevel(FutureRpcResults.LogLevel level) Sets a custom on-enter SLF4J logging level. The log message mentions the RPC method name and the provided input. By default, it isLOG.trace
. SettingNONE
will disable this logging. -
withRpcErrorMessage
public FutureRpcResults.FutureRpcResultBuilder<I,O> withRpcErrorMessage(Function<Throwable, String> newRpcErrorMessageFunction) Set a customRpcError
message function, for a given exception. By default, the message is justThrowable.getMessage()
. -
onSuccess
Sets a custom on-success action, for a given output.
-