F
- type of the fencing tokenpublic class FencedPekkoInvocationHandler<F extends Serializable> extends Object implements MainThreadExecutable, FencedRpcGateway<F>
PekkoInvocationHandler
. 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 |
forceRpcInvocationSerialization |
protected boolean |
isLocal |
Constructor and Description |
---|
FencedPekkoInvocationHandler(String address,
String hostname,
org.apache.pekko.actor.ActorRef rpcEndpoint,
Duration timeout,
long maximumFramesize,
boolean forceRpcInvocationSerialization,
CompletableFuture<Void> terminationFuture,
Supplier<F> fencingTokenSupplier,
boolean captureAskCallStacks,
ClassLoader flinkClassLoader) |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<?> |
ask(Object message,
Duration timeout)
Sends the message to the RPC endpoint and returns a future containing its response.
|
<V> CompletableFuture<V> |
callAsync(Callable<V> callable,
Duration callTimeout)
Execute the callable in the main thread of the underlying RPC endpoint and return a future
for the callable result.
|
org.apache.pekko.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 |
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, wait
callAsync, runAsync, scheduleRunAsync
getAddress, getHostname
protected final boolean isLocal
protected final boolean forceRpcInvocationSerialization
public FencedPekkoInvocationHandler(String address, String hostname, org.apache.pekko.actor.ActorRef rpcEndpoint, Duration timeout, long maximumFramesize, boolean forceRpcInvocationSerialization, @Nullable CompletableFuture<Void> terminationFuture, Supplier<F> fencingTokenSupplier, boolean captureAskCallStacks, ClassLoader flinkClassLoader)
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
public void tell(Object message)
message
- to send to the RPC endpoint.public CompletableFuture<?> ask(Object message, Duration timeout)
message
- to send to the RPC endpointtimeout
- time to wait until the response future is failed with a TimeoutException
public F getFencingToken()
FencedRpcGateway
getFencingToken
in interface FencedRpcGateway<F extends Serializable>
public org.apache.pekko.actor.ActorRef getActorRef()
ActorRef
of the underlying RPC actor.ActorRef
of the underlying RPC actorpublic void runAsync(Runnable runnable)
MainThreadExecutable
runAsync
in interface MainThreadExecutable
runnable
- Runnable to be executedpublic void scheduleRunAsync(Runnable runnable, long delayMillis)
MainThreadExecutable
scheduleRunAsync
in interface MainThreadExecutable
runnable
- Runnable to be executeddelayMillis
- The delay, in milliseconds, after which the runnable will be executedpublic <V> CompletableFuture<V> callAsync(Callable<V> callable, Duration callTimeout)
MainThreadExecutable
TimeoutException
.callAsync
in interface MainThreadExecutable
V
- Return value of the callablecallable
- Callable to be executedcallTimeout
- Timeout for the future to completepublic void start()
StartStoppable
start
in interface StartStoppable
public void stop()
StartStoppable
stop
in interface StartStoppable
public String getAddress()
RpcGateway
getAddress
in interface RpcGateway
public String getHostname()
RpcGateway
getHostname
in interface RpcGateway
public CompletableFuture<Void> getTerminationFuture()
RpcServer
getTerminationFuture
in interface RpcServer
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.