public final class RpcUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RpcUtils.NettyRpcCallable<T>
An interface representing a netty RPC callable.
|
static interface |
RpcUtils.RpcCallable<T>
An interface representing a callable which can only throw Alluxio exceptions.
|
static interface |
RpcUtils.RpcCallableThrowsIOException<T>
An interface representing a callable which can only throw Alluxio or IO exceptions.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
call(org.slf4j.Logger logger,
RpcUtils.RpcCallable<T> callable,
String methodName,
boolean failureOk,
String description,
Object... args)
Calls the given
RpcUtils.RpcCallable and handles any exceptions thrown. |
static <T> T |
call(org.slf4j.Logger logger,
RpcUtils.RpcCallable<T> callable,
String methodName,
String description,
Object... args)
Calls the given
RpcUtils.RpcCallable and handles any exceptions thrown. |
static <T> T |
call(org.slf4j.Logger logger,
RpcUtils.RpcCallableThrowsIOException<T> callable,
String methodName,
boolean failureOk,
String description,
Object... args)
Calls the given
RpcUtils.RpcCallableThrowsIOException and handles any exceptions thrown. |
static <T> T |
call(org.slf4j.Logger logger,
RpcUtils.RpcCallableThrowsIOException<T> callable,
String methodName,
String description,
Object... args)
Calls the given
RpcUtils.RpcCallableThrowsIOException and handles any exceptions thrown. |
static <T> T |
call(RpcUtils.RpcCallable<T> callable)
Calls the given
RpcUtils.RpcCallable and handles any exceptions thrown. |
static <T> T |
call(RpcUtils.RpcCallableThrowsIOException<T> callable)
Calls the given
RpcUtils.RpcCallableThrowsIOException and handles any exceptions thrown. |
static <T> T |
nettyRPCAndLog(org.slf4j.Logger logger,
RpcUtils.NettyRpcCallable<T> callable,
String methodName,
String description,
Object... args)
Handles a netty RPC callable with logging.
|
public static <T> T call(RpcUtils.RpcCallable<T> callable) throws AlluxioTException
RpcUtils.RpcCallable
and handles any exceptions thrown. No call history or
errors will be logged. This method should be used for internal RPCs.T
- the return type of the callablecallable
- the callable to callAlluxioTException
- if the callable throws an exceptionpublic static <T> T call(org.slf4j.Logger logger, RpcUtils.RpcCallable<T> callable, String methodName, String description, Object... args) throws AlluxioTException
RpcUtils.RpcCallable
and handles any exceptions thrown. If the RPC fails, a
warning or error will be logged.T
- the return type of the callablelogger
- the logger to use for this callcallable
- the callable to callmethodName
- the name of the method, used for metricsdescription
- the format string of the description, used for loggingargs
- the arguments for the descriptionAlluxioTException
- if the callable throws an exceptionpublic static <T> T call(org.slf4j.Logger logger, RpcUtils.RpcCallable<T> callable, String methodName, boolean failureOk, String description, Object... args) throws AlluxioTException
RpcUtils.RpcCallable
and handles any exceptions thrown.
The failureOk parameter indicates whether or not AlluxioExceptions are expected results (for
example it would be false for the exists() call). In this case, we do not log the failure or
increment failure metrics. When a RuntimeException is thrown, we always treat it as a failure
and log an error and increment metrics.T
- the return type of the callablelogger
- the logger to use for this callcallable
- the callable to callmethodName
- the name of the method, used for metricsfailureOk
- whether failures are expected (affects logging and metrics)description
- the format string of the description, used for loggingargs
- the arguments for the descriptionAlluxioTException
- if the callable throws an exceptionpublic static <T> T call(RpcUtils.RpcCallableThrowsIOException<T> callable) throws AlluxioTException
RpcUtils.RpcCallableThrowsIOException
and handles any exceptions thrown. No call
history or errors will be logged. This method should be used for internal RPCs.T
- the return type of the callablecallable
- the callable to callAlluxioTException
- if the callable throws an exceptionpublic static <T> T call(org.slf4j.Logger logger, RpcUtils.RpcCallableThrowsIOException<T> callable, String methodName, String description, Object... args) throws AlluxioTException
RpcUtils.RpcCallableThrowsIOException
and handles any exceptions thrown. If the
RPC fails, a warning or error will be logged.T
- the return type of the callablelogger
- the logger to use for this callcallable
- the callable to callmethodName
- the name of the method, used for metricsdescription
- the format string of the description, used for loggingargs
- the arguments for the descriptionAlluxioTException
- if the callable throws an exceptionpublic static <T> T call(org.slf4j.Logger logger, RpcUtils.RpcCallableThrowsIOException<T> callable, String methodName, boolean failureOk, String description, Object... args) throws AlluxioTException
RpcUtils.RpcCallableThrowsIOException
and handles any exceptions thrown.
The failureOk parameter indicates whether or not AlluxioExceptions and IOExceptions are
expected results (for example it would be false for the exists() call). In this case, we do not
log the failure or increment failure metrics. When a RuntimeException is thrown, we always
treat it as a failure and log an error and increment metrics.T
- the return type of the callablelogger
- the logger to use for this callcallable
- the callable to callmethodName
- the name of the method, used for metricsfailureOk
- whether failures are expected (affects logging and metrics)description
- the format string of the description, used for loggingargs
- the arguments for the descriptionAlluxioTException
- if the callable throws an exceptionpublic static <T> T nettyRPCAndLog(org.slf4j.Logger logger, RpcUtils.NettyRpcCallable<T> callable, String methodName, String description, Object... args)
T
- the return type of the callablelogger
- the logger to use for this callcallable
- the callable to callmethodName
- the name of the method, used for metricsdescription
- the format string of the description, used for loggingargs
- the arguments for the descriptionCopyright © 2023. All Rights Reserved.