public class RpcUtils extends Object
Modifier and Type | Field and Description |
---|---|
static java.time.Duration |
INF_DURATION |
static Time |
INF_TIMEOUT
HACK: Set to 21474835 seconds, Akka's maximum delay (Akka 2.4.20).
|
Modifier and Type | Method and Description |
---|---|
static Set<Class<? extends RpcGateway>> |
extractImplementedRpcGateways(Class<?> clazz)
Extracts all
RpcGateway interfaces implemented by the given clazz. |
static String |
getHostname(RpcService rpcService)
Returns the hostname onto which the given
RpcService has been bound. |
static void |
terminateRpcEndpoint(RpcEndpoint rpcEndpoint,
Time timeout)
Shuts the given
RpcEndpoint down and awaits its termination. |
static void |
terminateRpcEndpoints(Time timeout,
RpcEndpoint... rpcEndpoints)
Shuts the given
RpcEndpoints down and waits for their termination. |
static void |
terminateRpcService(RpcService rpcService,
Time timeout)
Shuts the given rpc service down and waits for its termination.
|
static void |
terminateRpcServices(Time timeout,
RpcService... rpcServices)
Shuts the given rpc services down and waits for their termination.
|
public static final Time INF_TIMEOUT
IllegalArgumentException
will be thrown during an RPC. Check the private
method checkMaxDelay()
in LightArrayRevolverScheduler
.public static final java.time.Duration INF_DURATION
public static Set<Class<? extends RpcGateway>> extractImplementedRpcGateways(Class<?> clazz)
RpcGateway
interfaces implemented by the given clazz.clazz
- from which to extract the implemented RpcGateway interfacespublic static void terminateRpcEndpoint(RpcEndpoint rpcEndpoint, Time timeout) throws ExecutionException, InterruptedException, TimeoutException
RpcEndpoint
down and awaits its termination.rpcEndpoint
- to terminatetimeout
- for this operationExecutionException
- if a problem occurredInterruptedException
- if the operation has been interruptedTimeoutException
- if a timeout occurredpublic static void terminateRpcEndpoints(Time timeout, RpcEndpoint... rpcEndpoints) throws InterruptedException, ExecutionException, TimeoutException
RpcEndpoints
down and waits for their termination.rpcEndpoints
- to shut downtimeout
- for this operationInterruptedException
- if the operation has been interruptedExecutionException
- if a problem occurredTimeoutException
- if a timeout occurredpublic static void terminateRpcService(RpcService rpcService, Time timeout) throws InterruptedException, ExecutionException, TimeoutException
rpcService
- to shut downtimeout
- for this operationInterruptedException
- if the operation has been interruptedExecutionException
- if a problem occurredTimeoutException
- if a timeout occurredpublic static void terminateRpcServices(Time timeout, RpcService... rpcServices) throws InterruptedException, ExecutionException, TimeoutException
rpcServices
- to shut downtimeout
- for this operationInterruptedException
- if the operation has been interruptedExecutionException
- if a problem occurredTimeoutException
- if a timeout occurredpublic static String getHostname(RpcService rpcService)
RpcService
has been bound. If the RpcService
has been started in local mode, then the hostname is "hostname"
.rpcService
- to retrieve the hostname forRpcService
has been bound or localhostCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.