Class FutureRpcResults.FutureRpcResultBuilder<I,O>
- java.lang.Object
-
- org.opendaylight.serviceutils.tools.mdsal.rpc.FutureRpcResults.FutureRpcResultBuilder<I,O>
-
- All Implemented Interfaces:
org.opendaylight.yangtools.concepts.Builder<Future<org.opendaylight.yangtools.yang.common.RpcResult<O>>>
,org.opendaylight.yangtools.concepts.CheckedBuilder<Future<org.opendaylight.yangtools.yang.common.RpcResult<O>>,IllegalArgumentException>
,org.opendaylight.yangtools.concepts.Mutable
,org.opendaylight.yangtools.concepts.MutationBehaviour<org.opendaylight.yangtools.concepts.Mutable>
- Enclosing class:
- FutureRpcResults
public static final class FutureRpcResults.FutureRpcResultBuilder<I,O> extends Object implements org.opendaylight.yangtools.concepts.Builder<Future<org.opendaylight.yangtools.yang.common.RpcResult<O>>>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<O>>
build()
Builds the Future RpcResult.FutureRpcResults.FutureRpcResultBuilder<I,O>
onEnterLogLevel(FutureRpcResults.LogLevel level)
Sets a custom on-enter SLF4J logging level.FutureRpcResults.FutureRpcResultBuilder<I,O>
onFailure(Consumer<Throwable> newOnFailureConsumer)
Sets a custom on-failure action, for a given exception.FutureRpcResults.FutureRpcResultBuilder<I,O>
onFailureLogLevel(FutureRpcResults.LogLevel level)
Sets a custom on-failure SLF4J logging level, in case of an exception.FutureRpcResults.FutureRpcResultBuilder<I,O>
onSuccess(Consumer<O> newOnSuccessFunction)
Sets a custom on-success action, for a given output.FutureRpcResults.FutureRpcResultBuilder<I,O>
onSuccessLogLevel(FutureRpcResults.LogLevel level)
Sets a custom on-success SLF4J logging level.FutureRpcResults.FutureRpcResultBuilder<I,O>
withRpcErrorMessage(Function<Throwable,String> newRpcErrorMessageFunction)
Set a customRpcError
message function, for a given exception.
-
-
-
Method Detail
-
build
@CheckReturnValue public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<O>> build()
Builds the Future RpcResult.- Specified by:
build
in interfaceorg.opendaylight.yangtools.concepts.Builder<I>
- Specified by:
build
in interfaceorg.opendaylight.yangtools.concepts.CheckedBuilder<I,O>
- 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
public FutureRpcResults.FutureRpcResultBuilder<I,O> onSuccess(Consumer<O> newOnSuccessFunction)
Sets a custom on-success action, for a given output.
-
-