Interface Transport

All Superinterfaces:
Lifecycle
All Known Implementing Classes:
AbstractDelegatingTransport, AbstractTransport, JGroupsTransport

public interface Transport extends Lifecycle
An interface that provides a communication link with remote caches. Also allows remote caches to invoke commands on this cache instance.
Since:
4.0
Author:
Manik Surtani, Galder ZamarreƱo
  • Method Details

    • invokeRemotely

      @Deprecated(forRemoval=true) default Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, boolean anycast) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      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 is true, it means that it must use TOA instead of TOB.
      Returns:
      a map of responses from each member contacted.
      Throws:
      Exception - in the event of problems.
    • invokeRemotelyAsync

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

      void sendTo(Address destination, ReplicableCommand rpcCommand, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) throws 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:
      Exception - if there was problem sending the request.
    • sendToMany

      void sendToMany(Collection<Address> destinations, ReplicableCommand rpcCommand, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) throws 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:
      Exception - if there was problem sending the request.
    • sendToAll

      @Experimental default void sendToAll(ReplicableCommand rpcCommand, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) throws Exception
      Asynchronously sends the ReplicableCommand to the entire cluster.
      Throws:
      Exception
      Since:
      9.2
    • invokeRemotely

      @Deprecated(forRemoval=true) default Map<Address,Response> invokeRemotely(Map<Address,ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter, boolean totalOrder, boolean anycast) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      Exception
    • invokeRemotely

      @Deprecated(forRemoval=true) default Map<Address,Response> invokeRemotely(Map<Address,ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, ResponseFilter responseFilter, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, boolean anycast) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      Exception
    • backupRemotely

      @Deprecated(forRemoval=true) BackupResponse backupRemotely(Collection<org.infinispan.xsite.XSiteBackup> backups, XSiteRequest<?> rpcCommand) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      Exception
    • backupRemotely

      <O> XSiteResponse<O> backupRemotely(org.infinispan.xsite.XSiteBackup backup, XSiteRequest<O> 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

      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

      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

      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
    • checkCrossSiteAvailable

      void checkCrossSiteAvailable() throws CacheConfigurationException
      Checks if this Transport is able to perform cross-site requests.
      Throws:
      CacheConfigurationException - if cross-site isn't available.
    • localSiteName

      String localSiteName()
      Returns:
      The local site name or null if this Transport cannot make cross-site requests.
    • localNodeName

      default String localNodeName()
      Returns:
      The local node name, defaults to the local node address.
    • 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

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

      @Deprecated(forRemoval=true) void waitForView(int viewId) throws InterruptedException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Since 9.0, please use withView(int) instead.
      Throws:
      InterruptedException
    • getLog

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

      @Deprecated(forRemoval=true) default void checkTotalOrderSupported()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Total order support dropped
      check if the transport has configured with total order deliver properties (has the sequencer in JGroups protocol stack.
    • getSitesView

      Set<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.
    • isSiteCoordinator

      boolean isSiteCoordinator()
      Returns:
      true if this node is a cross-site replication coordinator.
    • getRelayNodesAddress

      Collection<Address> getRelayNodesAddress()
      Returns:
      The current site coordinators Address.
    • isPrimaryRelayNode

      default boolean isPrimaryRelayNode()
    • invokeCommand

      @Experimental default <T> CompletionStage<T> invokeCommand(Address target, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit)
      Invoke a command on a single node and pass the response to a ResponseCollector.

      If the target is the local node, the command is never executed and ResponseCollector.finish() is called directly.

      Since:
      9.1
    • invokeCommand

      @Experimental default <T> CompletionStage<T> invokeCommand(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, 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 node, it is ignored. The command is only executed on the remote nodes.

      Since:
      9.1
    • invokeCommandOnAll

      @Experimental default <T> CompletionStage<T> invokeCommandOnAll(ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit)
      Invoke a command on all the nodes in the cluster and pass the responses to a ResponseCollector.

      The command is not executed locally and it is not sent across RELAY2 bridges to remote sites.

      Since:
      9.1
    • invokeCommandOnAll

      @Experimental default <T> CompletionStage<T> invokeCommandOnAll(Collection<Address> requiredTargets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit)
      Invoke a command on all the nodes in the cluster and pass the responses to a ResponseCollector.

      he command is not executed locally and it is not sent across RELAY2 bridges to remote sites.

      Since:
      9.3
    • invokeCommandStaggered

      @Experimental default <T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, 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.

      The command is only executed on the remote nodes.

      Since:
      9.1
    • invokeCommands

      @Deprecated(forRemoval=true) default <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,ReplicableCommand> commandGenerator, ResponseCollector<T> responseCollector, long timeout, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Invoke different commands on a collection of nodes and pass the responses to a ResponseCollector.

      The command is only executed on the remote nodes.

    • invokeCommands

      @Experimental default <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,ReplicableCommand> commandGenerator, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit)
      Invoke different commands on a collection of nodes and pass the responses to a ResponseCollector.

      The command is only executed on the remote nodes.

      Since:
      9.2
    • raftManager

      org.infinispan.remoting.transport.raft.RaftManager raftManager()
      Returns:
      The RaftManager instance,