F - type of the fencing tokenpublic class FencedAkkaInvocationHandler<F extends Serializable> extends Object implements FencedMainThreadExecutable, FencedRpcGateway<F>
AkkaInvocationHandler. This invocation handler will be used in combination
with the FencedRpcEndpoint. The fencing is done by wrapping all messages in a FencedMessage.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isLocal |
| Constructor and Description |
|---|
FencedAkkaInvocationHandler(String address,
String hostname,
akka.actor.ActorRef rpcEndpoint,
org.apache.flink.api.common.time.Time timeout,
long maximumFramesize,
CompletableFuture<Void> terminationFuture,
java.util.function.Supplier<F> fencingTokenSupplier) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<?> |
ask(Object message,
org.apache.flink.api.common.time.Time timeout)
Sends the message to the RPC endpoint and returns a future containing
its response.
|
<V> CompletableFuture<V> |
callAsync(Callable<V> callable,
org.apache.flink.api.common.time.Time callTimeout)
Execute the callable in the main thread of the underlying RPC endpoint and return a future for
the callable result.
|
<V> CompletableFuture<V> |
callAsyncWithoutFencing(Callable<V> callable,
org.apache.flink.api.common.time.Time timeout)
Run the given callable in the main thread without attaching a fencing token.
|
protected RpcInvocation |
createRpcInvocationMessage(String methodName,
Class<?>[] parameterTypes,
Object[] args)
Create the RpcInvocation message for the given RPC.
|
akka.actor.ActorRef |
getActorRef()
Returns the
ActorRef of the underlying RPC actor. |
String |
getAddress()
Returns the fully qualified address under which the associated rpc endpoint is reachable.
|
F |
getFencingToken()
Get the current fencing token.
|
String |
getHostname()
Returns the fully qualified hostname under which the associated rpc endpoint is reachable.
|
CompletableFuture<Void> |
getTerminationFuture()
Return a future which is completed when the rpc endpoint has been terminated.
|
Object |
invoke(Object proxy,
Method method,
Object[] args) |
void |
runAsync(Runnable runnable)
Execute the runnable in the main thread of the underlying RPC endpoint.
|
void |
runAsyncWithoutFencing(Runnable runnable)
Run the given runnable in the main thread without attaching a fencing token.
|
void |
scheduleRunAsync(Runnable runnable,
long delayMillis)
Execute the runnable in the main thread of the underlying RPC endpoint, with
a delay of the given number of milliseconds.
|
void |
start()
Starts the processing of remote procedure calls.
|
void |
stop()
Stops the processing of remote procedure calls.
|
void |
tell(Object message)
Sends the message to the RPC endpoint.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcallAsync, runAsync, scheduleRunAsyncgetAddress, getHostnamepublic FencedAkkaInvocationHandler(String address, String hostname, akka.actor.ActorRef rpcEndpoint, org.apache.flink.api.common.time.Time timeout, long maximumFramesize, @Nullable CompletableFuture<Void> terminationFuture, java.util.function.Supplier<F> fencingTokenSupplier)
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke in interface InvocationHandlerThrowablepublic void runAsyncWithoutFencing(Runnable runnable)
FencedMainThreadExecutablerunAsyncWithoutFencing in interface FencedMainThreadExecutablerunnable - to run in the main thread without validating the fencing token.public <V> CompletableFuture<V> callAsyncWithoutFencing(Callable<V> callable, org.apache.flink.api.common.time.Time timeout)
FencedMainThreadExecutablecallAsyncWithoutFencing in interface FencedMainThreadExecutableV - type of the callable resultcallable - to run in the main thread without validating the fencing token.timeout - for the operationpublic void tell(Object message)
message - to send to the RPC endpoint.public CompletableFuture<?> ask(Object message, org.apache.flink.api.common.time.Time timeout)
message - to send to the RPC endpointtimeout - time to wait until the response future is failed with a TimeoutExceptionpublic F getFencingToken()
FencedRpcGatewaygetFencingToken in interface FencedRpcGateway<F extends Serializable>public akka.actor.ActorRef getActorRef()
ActorRef of the underlying RPC actor.ActorRef of the underlying RPC actorpublic void runAsync(Runnable runnable)
MainThreadExecutablerunAsync in interface MainThreadExecutablerunnable - Runnable to be executedpublic void scheduleRunAsync(Runnable runnable, long delayMillis)
MainThreadExecutablescheduleRunAsync in interface MainThreadExecutablerunnable - Runnable to be executeddelayMillis - The delay, in milliseconds, after which the runnable will be executedpublic <V> CompletableFuture<V> callAsync(Callable<V> callable, org.apache.flink.api.common.time.Time callTimeout)
MainThreadExecutableTimeoutException.callAsync in interface MainThreadExecutableV - Return value of the callablecallable - Callable to be executedcallTimeout - Timeout for the future to completepublic void start()
StartStoppablestart in interface StartStoppablepublic void stop()
StartStoppablestop in interface StartStoppableprotected RpcInvocation createRpcInvocationMessage(String methodName, Class<?>[] parameterTypes, Object[] args) throws IOException
methodName - of the RPCparameterTypes - of the RPCargs - of the RPCIOException - if we cannot serialize the RPC invocation parameterspublic String getAddress()
RpcGatewaygetAddress in interface RpcGatewaypublic String getHostname()
RpcGatewaygetHostname in interface RpcGatewaypublic CompletableFuture<Void> getTerminationFuture()
RpcServergetTerminationFuture in interface RpcServerCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.