Class RpcManagerImpl

  • All Implemented Interfaces:
    JmxStatisticsExposer, RpcManager

    public class RpcManagerImpl
    extends java.lang.Object
    implements RpcManager, JmxStatisticsExposer
    This component really is just a wrapper around a Transport implementation, and is used to set up the transport and provide lifecycle and dependency hooks into external transport implementations.
    Since:
    4.0
    Author:
    Manik Surtani, Galder ZamarreƱo, Mircea.Markus@jboss.com, Pedro Ruivo
    • Constructor Detail

      • RpcManagerImpl

        public RpcManagerImpl()
    • Method Detail

      • getCommittedViewAsString

        public java.lang.String getCommittedViewAsString()
      • getPendingViewAsString

        public java.lang.String getPendingViewAsString()
      • invokeCommand

        public <T> java.util.concurrent.CompletionStage<T> invokeCommand​(java.util.Collection<Address> targets,
                                                                         org.infinispan.commands.ReplicableCommand command,
                                                                         ResponseCollector<T> collector,
                                                                         RpcOptions rpcOptions)
        Description copied from interface: RpcManager
        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.
        Specified by:
        invokeCommand in interface RpcManager
      • invokeCommandOnAll

        public <T> java.util.concurrent.CompletionStage<T> invokeCommandOnAll​(org.infinispan.commands.ReplicableCommand command,
                                                                              ResponseCollector<T> collector,
                                                                              RpcOptions rpcOptions)
        Description copied from interface: RpcManager
        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.
        Specified by:
        invokeCommandOnAll in interface RpcManager
      • invokeCommandStaggered

        public <T> java.util.concurrent.CompletionStage<T> invokeCommandStaggered​(java.util.Collection<Address> targets,
                                                                                  org.infinispan.commands.ReplicableCommand command,
                                                                                  ResponseCollector<T> collector,
                                                                                  RpcOptions rpcOptions)
        Description copied from interface: RpcManager
        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.
        Specified by:
        invokeCommandStaggered in interface RpcManager
      • invokeCommands

        public <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)
        Description copied from interface: RpcManager
        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.
        Specified by:
        invokeCommands in interface RpcManager
      • blocking

        public <T> T blocking​(java.util.concurrent.CompletionStage<T> request)
        Description copied from interface: RpcManager
        Block on a request and return its result.
        Specified by:
        blocking in interface RpcManager
      • invokeRemotelyAsync

        public java.util.concurrent.CompletableFuture<java.util.Map<Address,​Response>> invokeRemotelyAsync​(java.util.Collection<Address> recipients,
                                                                                                                 org.infinispan.commands.ReplicableCommand rpc,
                                                                                                                 RpcOptions options)
        Description copied from interface: RpcManager
        Invokes a command on remote nodes.
        Specified by:
        invokeRemotelyAsync in interface RpcManager
        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

        public java.util.Map<Address,​Response> invokeRemotely​(java.util.Collection<Address> recipients,
                                                                    org.infinispan.commands.ReplicableCommand rpc,
                                                                    RpcOptions options)
        Description copied from interface: RpcManager
        Invokes an RPC call on other caches in the cluster.
        Specified by:
        invokeRemotely in interface RpcManager
        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

        public void sendTo​(Address destination,
                           org.infinispan.commands.ReplicableCommand command,
                           DeliverOrder deliverOrder)
        Description copied from interface: RpcManager
        Asynchronously sends the ReplicableCommand to the destination using the specified DeliverOrder.
        Specified by:
        sendTo in interface RpcManager
        Parameters:
        destination - the destination's Address.
        command - the ReplicableCommand to send.
        deliverOrder - the DeliverOrder to use.
      • sendToMany

        public void sendToMany​(java.util.Collection<Address> destinations,
                               org.infinispan.commands.ReplicableCommand command,
                               DeliverOrder deliverOrder)
        Description copied from interface: RpcManager
        Asynchronously sends the ReplicableCommand to the set of destination using the specified DeliverOrder.
        Specified by:
        sendToMany in interface RpcManager
        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

        public void sendToAll​(org.infinispan.commands.ReplicableCommand command,
                              DeliverOrder deliverOrder)
        Description copied from interface: RpcManager
        Asynchronously sends the ReplicableCommand to the entire cluster.
        Specified by:
        sendToAll in interface RpcManager
      • getReplicationCount

        public long getReplicationCount()
      • getReplicationFailures

        public long getReplicationFailures()
      • isStatisticsEnabled

        public boolean isStatisticsEnabled()
      • setStatisticsEnabled

        @Deprecated
        public void setStatisticsEnabled​(boolean statisticsEnabled)
        Deprecated.
        We already have an attribute, we shouldn't have an operation for the same thing.
        Description copied from interface: JmxStatisticsExposer
        Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.
        Specified by:
        setStatisticsEnabled in interface JmxStatisticsExposer
        Parameters:
        statisticsEnabled - true if statistics should be captured
      • getSuccessRatio

        public java.lang.String getSuccessRatio()
      • getSuccessRatioFloatingPoint

        public double getSuccessRatioFloatingPoint()
      • getAverageReplicationTime

        public long getAverageReplicationTime()
      • getSitesView

        public java.lang.String getSitesView()
      • getAverageXSiteReplicationTime

        public long getAverageXSiteReplicationTime()
      • getMinimumXSiteReplicationTime

        public long getMinimumXSiteReplicationTime()
      • getMaximumXSiteReplicationTime

        public long getMaximumXSiteReplicationTime()
      • getSyncXSiteCount

        public long getSyncXSiteCount()
      • getAsyncXSiteCount

        public long getAsyncXSiteCount()
      • setTransport

        public void setTransport​(Transport t)
      • getAddress

        public Address getAddress()
        Description copied from interface: RpcManager
        Returns the address associated with this RpcManager or null if not part of the cluster.
        Specified by:
        getAddress in interface RpcManager
      • getTopologyId

        public int getTopologyId()
        Description copied from interface: RpcManager
        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.
        Specified by:
        getTopologyId in interface RpcManager
      • getMembers

        public java.util.List<Address> getMembers()
        Description copied from interface: RpcManager
        Returns members of a cluster scoped to the cache owning this RpcManager. Note that this List is always a subset of Transport.getMembers()
        Specified by:
        getMembers in interface RpcManager
        Returns:
        a list of cache scoped cluster members