Interface RPCExecutable
- All Known Subinterfaces:
ChainableRPC, RPC, RPCChain
public interface RPCExecutable
Represents any request that can be executed like a rpc providing both sync and async method execution access.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescription<T> @NonNull CompletableFuture<T> fire()Fires the current rpc into the first channel of the associated network component and returns a future which will be completed with the return value of the method execution when it's available or completed with a timeout exception when the query packet future times out.<T> @NonNull CompletableFuture<T> fire(@NonNull NetworkChannel component) Fires the current rpc into the given network channel and returns a future which will be completed with the return value of the method execution when it's available or completed with a timeout exception when the query packet future times out.voidFires the current rpc into the first channel of the associated network component and doesn't wait for the result of the rpc to become available.voidfireAndForget(@NonNull NetworkChannel component) Fires the current rpc into the given network channel and doesn't wait for the result of the rpc to become available.<T> @UnknownNullability TfireSync()Fires the current rpc into the first channel of the associated network component and waits for the result to become available, or times out after 30 seconds.<T> TfireSync(@NonNull NetworkChannel component) Fires the current rpc into the given network channel and waits for the result to become available, or times out after 30 seconds.
-
Method Details
-
fireAndForget
Fires the current rpc into the first channel of the associated network component and doesn't wait for the result of the rpc to become available. This method will not suspend the current thread.- Throws:
NullPointerException- if the associated network component has no channels available.
-
fireSync
Fires the current rpc into the first channel of the associated network component and waits for the result to become available, or times out after 30 seconds. This method will suspend the calling thread.- Type Parameters:
T- the expected return type.- Returns:
- the result of the method invocation, might be null if the remote method returned null.
- Throws:
NullPointerException- if the associated network component has no channels available.RPCExecutionException- if any exception occurred on the remote component during the rpc processing.RPCException- if any other exception occurs during the rpc processing.
-
fire
Fires the current rpc into the first channel of the associated network component and returns a future which will be completed with the return value of the method execution when it's available or completed with a timeout exception when the query packet future times out.- Type Parameters:
T- the expected return type.- Returns:
- a task completed with the result of the method invocation, null if the remote method returned null.
- Throws:
NullPointerException- if the associated network component has no channels available.
-
fireAndForget
Fires the current rpc into the given network channel and doesn't wait for the result of the rpc to become available. This method will not suspend the current thread.- Parameters:
component- the network channel to which the rpc should be sent.- Throws:
NullPointerException- if the given network channel is null.
-
fireSync
Fires the current rpc into the given network channel and waits for the result to become available, or times out after 30 seconds. This method will suspend the calling thread.- Type Parameters:
T- the expected return type.- Parameters:
component- the network channel to which the rpc should be sent.- Returns:
- the result of the method invocation, might be null if the remote method returned null.
- Throws:
NullPointerException- if the given network channel is null.RPCExecutionException- if any exception occurred on the remote component during the rpc processing.RPCException- if any other exception occurs during the rpc processing.
-
fire
Fires the current rpc into the given network channel and returns a future which will be completed with the return value of the method execution when it's available or completed with a timeout exception when the query packet future times out. Note: if the target method return a task, this method does not return a task wrapping a task, but rather the return value in the task directly.- Type Parameters:
T- the expected return type.- Parameters:
component- the network channel to which the rpc should be sent.- Returns:
- a task completed with the result of the method invocation, null if the remote method returned null.
- Throws:
NullPointerException- if the given network channel is null.
-