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 Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description BackupResponse
backupRemotely(Collection<XSiteBackup> backups, XSiteReplicateCommand rpcCommand)
void
checkTotalOrderSupported()
check if the transport has configured with total order deliver properties (has the sequencer in JGroups protocol stack.Address
getAddress()
Retrieves the current cache instance's network addressAddress
getCoordinator()
org.infinispan.util.logging.Log
getLog()
List<Address>
getMembers()
Returns a list of members in the current cluster view.List<Address>
getPhysicalAddresses()
Retrieves the current cache instance's physical network addresses.Set<String>
getSitesView()
Get the view of interconnected sites.int
getViewId()
default <T> CompletionStage<T>
invokeCommand(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on a collection of node and pass the responses to aResponseCollector
.default <T> CompletionStage<T>
invokeCommand(Address target, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on a single node and pass the response to aResponseCollector
.default <T> CompletionStage<T>
invokeCommandOnAll(Collection<Address> requiredTargets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on all the nodes in the cluster and pass the responses to aResponseCollector
.default <T> CompletionStage<T>
invokeCommandOnAll(org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on all the nodes in the cluster and pass the responses to aResponseCollector
.default <T> CompletionStage<T>
invokeCommands(Collection<Address> targets, Function<Address,org.infinispan.commands.ReplicableCommand> commandGenerator, ResponseCollector<T> responseCollector, long timeout, DeliverOrder deliverOrder)
Deprecated.Introduced in 9.1, but replaced in 9.2 withinvokeCommands(Collection, Function, ResponseCollector, DeliverOrder, long, TimeUnit)
.default <T> CompletionStage<T>
invokeCommands(Collection<Address> targets, Function<Address,org.infinispan.commands.ReplicableCommand> commandGenerator, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit)
Invoke different commands on a collection of nodes and pass the responses to aResponseCollector
.default <T> CompletionStage<T>
invokeCommandStaggered(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on a collection of nodes and pass the responses to aResponseCollector
.default Map<Address,Response>
invokeRemotely(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast)
Deprecated.Since 9.2, please useinvokeCommand(Collection, ReplicableCommand, ResponseCollector, DeliverOrder, long, TimeUnit)
instead.default Map<Address,Response>
invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter, boolean totalOrder, boolean anycast)
Deprecated.default Map<Address,Response>
invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast)
Deprecated.Since 9.2, please useinvokeRemotelyAsync(Collection, ReplicableCommand, ResponseMode, long, ResponseFilter, DeliverOrder, boolean)
instead.CompletableFuture<Map<Address,Response>>
invokeRemotelyAsync(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast)
boolean
isCoordinator()
boolean
isMulticastCapable()
Tests whether the transport supports true multicastvoid
sendTo(Address destination, org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder)
Asynchronously sends theReplicableCommand
to the destination using the specifiedDeliverOrder
.default void
sendToAll(org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder)
Asynchronously sends theReplicableCommand
to the entire cluster.void
sendToMany(Collection<Address> destinations, org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder)
Asynchronously sends theReplicableCommand
to the set of destination using the specifiedDeliverOrder
.void
start()
Invoked on component startvoid
stop()
Invoked on component stopvoid
waitForView(int viewId)
Deprecated.Since 9.0, please usewithView(int)
instead.CompletableFuture<Void>
withView(int expectedViewId)
-
-
-
Method Detail
-
invokeRemotely
@Deprecated default Map<Address,Response> invokeRemotely(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception
Deprecated.Since 9.2, please useinvokeCommand(Collection, ReplicableCommand, ResponseCollector, DeliverOrder, long, TimeUnit)
instead.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 invokemode
- the response mode to usetimeout
- a timeout after which to throw a replication exception. implementations.responseFilter
- a response filter with which to filter out failed/unwanted/invalid responses.deliverOrder
- theDeliverOrder
.anycast
- used when {@param totalOrder} istrue
, 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, org.infinispan.commands.ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception
- Throws:
Exception
-
sendTo
void sendTo(Address destination, org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception
Asynchronously sends theReplicableCommand
to the destination using the specifiedDeliverOrder
.- Parameters:
destination
- the destination'sAddress
.rpcCommand
- theReplicableCommand
to send.deliverOrder
- theDeliverOrder
to use.- Throws:
Exception
- if there was problem sending the request.
-
sendToMany
void sendToMany(Collection<Address> destinations, org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception
Asynchronously sends theReplicableCommand
to the set of destination using the specifiedDeliverOrder
.- Parameters:
destinations
- the collection of destination'sAddress
. Ifnull
, it sends to all the members in the cluster.rpcCommand
- theReplicableCommand
to send.deliverOrder
- theDeliverOrder
to use.- Throws:
Exception
- if there was problem sending the request.
-
sendToAll
default void sendToAll(org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception
Asynchronously sends theReplicableCommand
to the entire cluster.- Throws:
Exception
- Since:
- 9.2
-
invokeRemotely
@Deprecated default Map<Address,Response> invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter, boolean totalOrder, boolean anycast) throws Exception
Deprecated.- Throws:
Exception
-
invokeRemotely
@Deprecated default Map<Address,Response> invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception
Deprecated.Since 9.2, please useinvokeRemotelyAsync(Collection, ReplicableCommand, ResponseMode, long, ResponseFilter, DeliverOrder, boolean)
instead.- Throws:
Exception
-
backupRemotely
BackupResponse backupRemotely(Collection<XSiteBackup> backups, XSiteReplicateCommand rpcCommand) throws Exception
- Throws:
Exception
-
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 asgetAddress()
.- 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.
-
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
-
stop
void stop()
Description copied from interface:Lifecycle
Invoked on component stop
-
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 void waitForView(int viewId) throws InterruptedException
Deprecated.Since 9.0, please usewithView(int)
instead.- Throws:
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
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.
-
invokeCommand
default <T> CompletionStage<T> invokeCommand(Address target, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on a single node and pass the response to aResponseCollector
.If the target is the local node and the delivery order is not
DeliverOrder.TOTAL
, the command is never executed, andResponseCollector.finish()
is called directly.- Since:
- 9.1
-
invokeCommand
default <T> CompletionStage<T> invokeCommand(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on a collection of node and pass the responses to aResponseCollector
.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> CompletionStage<T> invokeCommandOnAll(org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on all the nodes in the cluster and pass the responses to aResponseCollector
.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> CompletionStage<T> invokeCommandOnAll(Collection<Address> requiredTargets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on all the nodes in the cluster and pass the responses to aResponseCollector
.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> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Invoke a command on a collection of nodes and pass the responses to aResponseCollector
.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
@Deprecated default <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,org.infinispan.commands.ReplicableCommand> commandGenerator, ResponseCollector<T> responseCollector, long timeout, DeliverOrder deliverOrder)
Deprecated.Introduced in 9.1, but replaced in 9.2 withinvokeCommands(Collection, Function, ResponseCollector, DeliverOrder, long, TimeUnit)
.Invoke different commands on a collection of nodes and pass the responses to aResponseCollector
.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.
-
invokeCommands
default <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,org.infinispan.commands.ReplicableCommand> commandGenerator, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit)
Invoke different commands on a collection of nodes and pass the responses to aResponseCollector
.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
-
-