Interface Transport

    • Method Detail

      • invokeRemotely

        @Deprecated
        default java.util.Map<Address,​Response> invokeRemotely​(java.util.Collection<Address> recipients,
                                                                     org.infinispan.commands.ReplicableCommand rpcCommand,
                                                                     ResponseMode mode,
                                                                     long timeout,
                                                                     ResponseFilter responseFilter,
                                                                     DeliverOrder deliverOrder,
                                                                     boolean anycast)
                                                              throws java.lang.Exception
        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.
        rpcCommand - the cache command to invoke
        mode - the response mode to use
        timeout - a timeout after which to throw a replication exception. implementations.
        responseFilter - a response filter with which to filter out failed/unwanted/invalid responses.
        deliverOrder - the DeliverOrder.
        anycast - used when {@param totalOrder} is true, it means that it must use TOA instead of TOB.
        Returns:
        a map of responses from each member contacted.
        Throws:
        java.lang.Exception - in the event of problems.
      • invokeRemotelyAsync

        java.util.concurrent.CompletableFuture<java.util.Map<Address,​Response>> invokeRemotelyAsync​(java.util.Collection<Address> recipients,
                                                                                                          org.infinispan.commands.ReplicableCommand rpcCommand,
                                                                                                          ResponseMode mode,
                                                                                                          long timeout,
                                                                                                          ResponseFilter responseFilter,
                                                                                                          DeliverOrder deliverOrder,
                                                                                                          boolean anycast)
                                                                                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • sendTo

        void sendTo​(Address destination,
                    org.infinispan.commands.ReplicableCommand rpcCommand,
                    DeliverOrder deliverOrder)
             throws java.lang.Exception
        Asynchronously sends the ReplicableCommand to the destination using the specified DeliverOrder.
        Parameters:
        destination - the destination's Address.
        rpcCommand - the ReplicableCommand to send.
        deliverOrder - the DeliverOrder to use.
        Throws:
        java.lang.Exception - if there was problem sending the request.
      • sendToMany

        void sendToMany​(java.util.Collection<Address> destinations,
                        org.infinispan.commands.ReplicableCommand rpcCommand,
                        DeliverOrder deliverOrder)
                 throws java.lang.Exception
        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.
        rpcCommand - the ReplicableCommand to send.
        deliverOrder - the DeliverOrder to use.
        Throws:
        java.lang.Exception - if there was problem sending the request.
      • sendToAll

        default void sendToAll​(org.infinispan.commands.ReplicableCommand rpcCommand,
                               DeliverOrder deliverOrder)
                        throws java.lang.Exception
        Asynchronously sends the ReplicableCommand to the entire cluster.
        Throws:
        java.lang.Exception
        Since:
        9.2
      • backupRemotely

        XSiteResponse backupRemotely​(XSiteBackup backup,
                                     XSiteReplicateCommand rpcCommand)
        Sends a cross-site request to a remote site.

        Currently, no reply values are supported. Or the request completes successfully or it throws an Exception.

        If XSiteBackup.isSync() returns false, the XSiteResponse is only completed when the an ACK from the remote site is received. The invoker needs to make sure not to wait for the XSiteResponse.

        Parameters:
        backup - The remote site.
        rpcCommand - The command to send.
        Returns:
        A XSiteResponse that is completed when the request is completed.
      • isCoordinator

        boolean isCoordinator()
        Returns:
        true if the current Channel is the coordinator of the cluster.
      • getCoordinator

        Address getCoordinator()
        Returns:
        the Address of the current coordinator.
      • getAddress

        Address getAddress()
        Retrieves the current cache instance's network address
        Returns:
        an Address
      • getPhysicalAddresses

        java.util.List<Address> getPhysicalAddresses()
        Retrieves the current cache instance's physical network addresses. Some implementations might differentiate between logical and physical addresses in which case, this method allows clients to query the physical ones associated with the logical address. Implementations where logical and physical address are the same will simply return a single entry List that contains the same Address as getAddress().
        Returns:
        an List of Address
      • getMembers

        java.util.List<Address> getMembers()
        Returns a list of members in the current cluster view.
        Returns:
        a list of members. Typically, this would be defensively copied.
      • getMembersPhysicalAddresses

        java.util.List<Address> getMembersPhysicalAddresses()
        Returns physical addresses of members in the current cluster view.
        Returns:
        a list of physical addresses
      • isMulticastCapable

        boolean isMulticastCapable()
        Tests whether the transport supports true multicast
        Returns:
        true if the transport supports true multicast
      • start

        void start()
        Description copied from interface: Lifecycle
        Invoked on component start
        Specified by:
        start in interface Lifecycle
      • stop

        void stop()
        Description copied from interface: Lifecycle
        Invoked on component stop
        Specified by:
        stop in interface Lifecycle
      • getViewId

        int getViewId()
        Throws:
        CacheException - if the transport has been stopped.
      • withView

        java.util.concurrent.CompletableFuture<java.lang.Void> withView​(int expectedViewId)
        Returns:
        A CompletableFuture that completes when the transport has installed the expected view.
      • waitForView

        @Deprecated
        void waitForView​(int viewId)
                  throws java.lang.InterruptedException
        Deprecated.
        Since 9.0, please use withView(int) instead.
        Throws:
        java.lang.InterruptedException
      • getLog

        org.infinispan.util.logging.Log getLog()
      • checkTotalOrderSupported

        void checkTotalOrderSupported()
        check if the transport has configured with total order deliver properties (has the sequencer in JGroups protocol stack.
      • getSitesView

        java.util.Set<java.lang.String> getSitesView()
        Get the view of interconnected sites. If no cross site replication has been configured, this method returns null. Inspecting the site view can be useful to see if the different sites have managed to join each other, which is pre-requisite to get cross replication working.
        Returns:
        set containing the connected sites, or null if no cross site replication has been enabled.
      • invokeCommand

        default <T> java.util.concurrent.CompletionStage<T> invokeCommand​(Address target,
                                                                          org.infinispan.commands.ReplicableCommand command,
                                                                          ResponseCollector<T> collector,
                                                                          DeliverOrder deliverOrder,
                                                                          long timeout,
                                                                          java.util.concurrent.TimeUnit unit)
        Invoke a command on a single node and pass the response to a ResponseCollector.

        If the target is the local node and the delivery order is not DeliverOrder.TOTAL, the command is never executed, and ResponseCollector.finish() is called directly.

        Since:
        9.1
      • invokeCommand

        default <T> java.util.concurrent.CompletionStage<T> invokeCommand​(java.util.Collection<Address> targets,
                                                                          org.infinispan.commands.ReplicableCommand command,
                                                                          ResponseCollector<T> collector,
                                                                          DeliverOrder deliverOrder,
                                                                          long timeout,
                                                                          java.util.concurrent.TimeUnit unit)
        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.1
      • invokeCommandOnAll

        default <T> java.util.concurrent.CompletionStage<T> invokeCommandOnAll​(org.infinispan.commands.ReplicableCommand command,
                                                                               ResponseCollector<T> collector,
                                                                               DeliverOrder deliverOrder,
                                                                               long timeout,
                                                                               java.util.concurrent.TimeUnit unit)
        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.1
      • invokeCommandOnAll

        default <T> java.util.concurrent.CompletionStage<T> invokeCommandOnAll​(java.util.Collection<Address> requiredTargets,
                                                                               org.infinispan.commands.ReplicableCommand command,
                                                                               ResponseCollector<T> collector,
                                                                               DeliverOrder deliverOrder,
                                                                               long timeout,
                                                                               java.util.concurrent.TimeUnit unit)
        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.3
      • invokeCommandStaggered

        default <T> java.util.concurrent.CompletionStage<T> invokeCommandStaggered​(java.util.Collection<Address> targets,
                                                                                   org.infinispan.commands.ReplicableCommand command,
                                                                                   ResponseCollector<T> collector,
                                                                                   DeliverOrder deliverOrder,
                                                                                   long timeout,
                                                                                   java.util.concurrent.TimeUnit unit)
        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.1
      • invokeCommands

        default <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,
                                                                           DeliverOrder deliverOrder,
                                                                           long timeout,
                                                                           java.util.concurrent.TimeUnit timeUnit)
        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