Interface RPC

All Superinterfaces:
ChainableRPC, RPCExecutable, RPCProvider

public interface RPC extends RPCProvider, RPCExecutable, ChainableRPC
The basic rpc class. A rpc holds all information about what should be called on the receiver site of the rpc and which information (if any) should get sent back when the current rpc expects a result. Exceptions are handled during the process and will be rethrown on the sender side rather than the receiver site.

The target method which should get called by the rpc is identified in 3 steps:

  1. Using the supplied target class of the rpc.
  2. Using the name of the method supplied to the rpc.
  3. Using the amount of arguments supplied to the rpc.

By default, if on all network components is the same version of a class available there is no way a method can not be identified by rpc as the creation of a sender based on a class with unclear methods will instantly result in an exception to prevent exceptions during the runtime.

Since:
4.0
  • Method Details

    • sender

      Get the sender from which the rpc call is coming (better known as the base class in which the method to call by this rpc is located in).
      Returns:
      the sender of this rpc.
    • className

      @NonNull @NonNull String className()
      Get the fully qualified name of the class the target method is located in.
      Returns:
      the fully qualified name of the class the target method is located in.
    • methodName

      @NonNull @NonNull String methodName()
      Get the name of the method which should get called.
      Returns:
      the name of the method which should get called.
    • methodDescriptor

      @NonNull @NonNull String methodDescriptor()
      Get the descriptor string of the method that should be invoked.
      Returns:
      the descriptor string of the method that should be invoked.
    • arguments

      @NonNull @NonNull Object[] arguments()
      Get the arguments which should get used to call the method. The main identification of a method happens based on the name and the amount of arguments supplied. Invalid arguments might cause exceptions on the receiver site.
      Returns:
      the arguments which should get used to call the method.
    • expectedResultType

      @NonNull @NonNull Type expectedResultType()
      Get the expected result type of the method invocation. Can be void.
      Returns:
      the expected result type of the method invocation.
    • targetMethod

      Get the full metadata of the target method.
      Returns:
      the full metadata of the target method.
    • timeout

      Sets the timeout that should be applied to the RPC. The default value is derived from the target in the target class (using the RPCTimeout annotation). If no timeout is set, the fire methods will wait for a method result forever.
      Parameters:
      timeout - the timeout to apply to the method invocation.
      Returns:
      this RPC, for chaining.
    • timeout

      Get the timeout that is applied to this RPC, if any.
      Returns:
      the timeout applied to this RPC.
    • dropResult

      @NonNull @NonNull RPC dropResult()
      Disables that this rpc is waiting for a result from the target network component. By default, the current component will always wait for the target method to be executed on the receiver site, event if the method returns void.
      Returns:
      the same instance used to call the method, for chaining.
    • resultDropped

      boolean resultDropped()
      Get whether the result of the method call is discarded and the execution of the method should not be waited for.
      Returns:
      true if the result of this RPC gets discarded, false otherwise.