Package org.apache.flink.runtime.rpc
Interface MainThreadExecutable
-
- All Known Subinterfaces:
RpcServer
public interface MainThreadExecutableInterface to executeRunnableandCallablein the main thread of the underlying RPC endpoint.This interface is intended to be implemented by the self gateway in a
RpcEndpointimplementation which allows to dispatch local procedures to the main thread of the underlying RPC endpoint.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <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.voidrunAsync(Runnable runnable)Execute the runnable in the main thread of the underlying RPC endpoint.voidscheduleRunAsync(Runnable runnable, long delay)Execute the runnable in the main thread of the underlying RPC endpoint, with a delay of the given number of milliseconds.
-
-
-
Method Detail
-
runAsync
void runAsync(Runnable runnable)
Execute the runnable in the main thread of the underlying RPC endpoint.- Parameters:
runnable- Runnable to be executed
-
callAsync
<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. If the future is not completed within the given timeout, the returned future will throw aTimeoutException.- Type Parameters:
V- Return value of the callable- Parameters:
callable- Callable to be executedcallTimeout- Timeout for the future to complete- Returns:
- Future of the callable result
-
scheduleRunAsync
void scheduleRunAsync(Runnable runnable, long delay)
Execute the runnable in the main thread of the underlying RPC endpoint, with a delay of the given number of milliseconds.- Parameters:
runnable- Runnable to be executeddelay- The delay, in milliseconds, after which the runnable will be executed
-
-