Interface RpcManager

  • All Known Implementing Classes:
    ExtendedStatisticRpcManager, RpcManagerImpl

    public interface RpcManager
    Provides a mechanism for communicating with other caches in the cluster, by formatting and passing requests down to the registered Transport.
    Since:
    4.0
    Author:
    Manik Surtani, Mircea.Markus@jboss.com
    • Method Detail

      • invokeCommand

        <T> java.util.concurrent.CompletionStage<T> invokeCommand​(java.util.Collection<Address> targets,
                                                                  org.infinispan.commands.ReplicableCommand command,
                                                                  ResponseCollector<T> collector,
                                                                  RpcOptions rpcOptions)
        Invoke a command on a collection of node and pass the responses to a ResponseCollector. If one of the targets is the local nodes and the delivery order is not DeliverOrder.TOTAL, the command is only executed on the remote nodes.
        Since:
        9.2
      • invokeCommandOnAll

        <T> java.util.concurrent.CompletionStage<T> invokeCommandOnAll​(org.infinispan.commands.ReplicableCommand command,
                                                                       ResponseCollector<T> collector,
                                                                       RpcOptions rpcOptions)
        Invoke a command on all the nodes in the cluster and pass the responses to a ResponseCollector. The command is only executed on the local node if the delivery order is DeliverOrder.TOTAL. The command is not sent across RELAY2 bridges to remote sites.
        Since:
        9.2
      • invokeCommandStaggered

        <T> java.util.concurrent.CompletionStage<T> invokeCommandStaggered​(java.util.Collection<Address> targets,
                                                                           org.infinispan.commands.ReplicableCommand command,
                                                                           ResponseCollector<T> collector,
                                                                           RpcOptions rpcOptions)
        Invoke a command on a collection of nodes and pass the responses to a ResponseCollector. The command is only sent immediately to the first target, and there is an implementation-dependent delay before sending the command to each target. There is no delay if the target responds or leaves the cluster. The remaining targets are skipped if ResponseCollector.addResponse(Address, Response) returns a non-null value. If one of the targets is the local node and the delivery order is not DeliverOrder.TOTAL, the command is only executed on the remote nodes.
        Since:
        9.2
      • invokeCommands

        <T> java.util.concurrent.CompletionStage<T> invokeCommands​(java.util.Collection<Address> targets,
                                                                   java.util.function.Function<Address,​org.infinispan.commands.ReplicableCommand> commandGenerator,
                                                                   ResponseCollector<T> collector,
                                                                   RpcOptions rpcOptions)
        Invoke different commands on a collection of nodes and pass the responses to a ResponseCollector. If one of the targets is the local node and the delivery order is not DeliverOrder.TOTAL, the command is only executed on the remote nodes.
        Since:
        9.2
      • blocking

        <T> T blocking​(java.util.concurrent.CompletionStage<T> request)
        Block on a request and return its result.
        Since:
        9.2
      • invokeRemotelyAsync

        java.util.concurrent.CompletableFuture<java.util.Map<Address,​Response>> invokeRemotelyAsync​(java.util.Collection<Address> recipients,
                                                                                                          org.infinispan.commands.ReplicableCommand rpc,
                                                                                                          RpcOptions options)
        Invokes a command on remote nodes.
        Parameters:
        recipients - A list of nodes, or null to invoke the command on all the members of the cluster
        rpc - The command to invoke
        options - The invocation options
        Returns:
        A future that, when completed, returns the responses from the remote nodes.
      • invokeRemotely

        @Deprecated
        java.util.Map<Address,​Response> invokeRemotely​(java.util.Collection<Address> recipients,
                                                             org.infinispan.commands.ReplicableCommand rpc,
                                                             RpcOptions options)
        Invokes an RPC call on other caches in the cluster.
        Parameters:
        recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
        rpc - command to execute remotely.
        options - it configures the invocation. The same instance can be re-used since RpcManager does not change it. Any change in RpcOptions during a remote invocation can lead to unpredictable behavior.
        Returns:
        a map of responses from each member contacted.
      • sendTo

        void sendTo​(Address destination,
                    org.infinispan.commands.ReplicableCommand command,
                    DeliverOrder deliverOrder)
        Asynchronously sends the ReplicableCommand to the destination using the specified DeliverOrder.
        Parameters:
        destination - the destination's Address.
        command - the ReplicableCommand to send.
        deliverOrder - the DeliverOrder to use.
      • sendToMany

        void sendToMany​(java.util.Collection<Address> destinations,
                        org.infinispan.commands.ReplicableCommand command,
                        DeliverOrder deliverOrder)
        Asynchronously sends the ReplicableCommand to the set of destination using the specified DeliverOrder.
        Parameters:
        destinations - the collection of destination's Address. If null, it sends to all the members in the cluster.
        command - the ReplicableCommand to send.
        deliverOrder - the DeliverOrder to use.
      • sendToAll

        void sendToAll​(org.infinispan.commands.ReplicableCommand command,
                       DeliverOrder deliverOrder)
        Asynchronously sends the ReplicableCommand to the entire cluster.
        Since:
        9.2
      • getTransport

        Transport getTransport()
        Returns:
        a reference to the underlying transport.
      • getMembers

        java.util.List<Address> getMembers()
        Returns members of a cluster scoped to the cache owning this RpcManager. Note that this List is always a subset of Transport.getMembers()
        Returns:
        a list of cache scoped cluster members
      • getAddress

        Address getAddress()
        Returns the address associated with this RpcManager or null if not part of the cluster.
      • getTopologyId

        int getTopologyId()
        Returns the current topology id. As opposed to the viewId which is updated whenever the cluster changes, the topologyId is updated when a new cache instance is started or removed - this doesn't necessarily coincide with a node being added/removed to the cluster.
      • getSyncRpcOptions

        RpcOptions getSyncRpcOptions()
        Returns:
        The default options for synchronous remote invocations.
      • getTotalSyncRpcOptions

        RpcOptions getTotalSyncRpcOptions()
        Returns:
        The default options for total order remote invocations.