Class AbstractDelegatingTransport
- java.lang.Object
-
- org.infinispan.remoting.transport.AbstractDelegatingTransport
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDelegatingTransport(Transport actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BackupResponse
afterBackupRemotely(org.infinispan.commands.ReplicableCommand command, BackupResponse response)
method invoked after a successful backup remote invocation.protected Map<Address,Response>
afterInvokeRemotely(org.infinispan.commands.ReplicableCommand command, Map<Address,Response> responseMap)
method invoked after a successful remote invocation.BackupResponse
backupRemotely(Collection<XSiteBackup> backups, XSiteReplicateCommand rpcCommand)
protected void
beforeBackupRemotely(XSiteReplicateCommand command)
method invoked before a backup remote invocation.protected void
beforeInvokeRemotely(org.infinispan.commands.ReplicableCommand command)
method invoked before a remote invocation.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()
Transport
getDelegate()
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()
<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
.<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
.<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
.<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
.<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
.Map<Address,Response>
invokeRemotely(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast)
Invokes an RPC call on other caches in the cluster.Map<Address,Response>
invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter, boolean totalOrder, boolean anycast)
Map<Address,Response>
invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast)
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
.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)
CompletableFuture<Void>
withView(int expectedViewId)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.remoting.transport.Transport
invokeCommandOnAll, invokeCommands
-
-
-
-
Field Detail
-
actual
protected final Transport actual
-
-
Constructor Detail
-
AbstractDelegatingTransport
protected AbstractDelegatingTransport(Transport actual)
-
-
Method Detail
-
invokeRemotely
public Map<Address,Response> invokeRemotely(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception
Description copied from interface:Transport
Invokes an RPC call on other caches in the cluster.- Specified by:
invokeRemotely
in interfaceTransport
- 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.
-
invokeRemotely
public 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
- Specified by:
invokeRemotely
in interfaceTransport
- Throws:
Exception
-
invokeRemotely
public Map<Address,Response> invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcCommands, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception
- Specified by:
invokeRemotely
in interfaceTransport
- Throws:
Exception
-
invokeRemotelyAsync
public 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
- Specified by:
invokeRemotelyAsync
in interfaceTransport
- Throws:
Exception
-
sendTo
public void sendTo(Address destination, org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception
Description copied from interface:Transport
Asynchronously sends theReplicableCommand
to the destination using the specifiedDeliverOrder
.- Specified by:
sendTo
in interfaceTransport
- Parameters:
destination
- the destination'sAddress
.rpcCommand
- theReplicableCommand
to send.deliverOrder
- theDeliverOrder
to use.- Throws:
Exception
- if there was problem sending the request.
-
sendToMany
public void sendToMany(Collection<Address> destinations, org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception
Description copied from interface:Transport
Asynchronously sends theReplicableCommand
to the set of destination using the specifiedDeliverOrder
.- Specified by:
sendToMany
in interfaceTransport
- 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
public void sendToAll(org.infinispan.commands.ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception
Description copied from interface:Transport
Asynchronously sends theReplicableCommand
to the entire cluster.
-
backupRemotely
public BackupResponse backupRemotely(Collection<XSiteBackup> backups, XSiteReplicateCommand rpcCommand) throws Exception
- Specified by:
backupRemotely
in interfaceTransport
- Throws:
Exception
-
isCoordinator
public boolean isCoordinator()
- Specified by:
isCoordinator
in interfaceTransport
- Returns:
- true if the current Channel is the coordinator of the cluster.
-
getCoordinator
public Address getCoordinator()
- Specified by:
getCoordinator
in interfaceTransport
- Returns:
- the Address of the current coordinator.
-
getAddress
public Address getAddress()
Description copied from interface:Transport
Retrieves the current cache instance's network address- Specified by:
getAddress
in interfaceTransport
- Returns:
- an Address
-
getPhysicalAddresses
public List<Address> getPhysicalAddresses()
Description copied from interface:Transport
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 asTransport.getAddress()
.- Specified by:
getPhysicalAddresses
in interfaceTransport
- Returns:
- an List of Address
-
getMembers
public List<Address> getMembers()
Description copied from interface:Transport
Returns a list of members in the current cluster view.- Specified by:
getMembers
in interfaceTransport
- Returns:
- a list of members. Typically, this would be defensively copied.
-
isMulticastCapable
public boolean isMulticastCapable()
Description copied from interface:Transport
Tests whether the transport supports true multicast- Specified by:
isMulticastCapable
in interfaceTransport
- Returns:
- true if the transport supports true multicast
-
start
public void start()
Description copied from interface:Lifecycle
Invoked on component start
-
stop
public void stop()
Description copied from interface:Lifecycle
Invoked on component stop
-
withView
public CompletableFuture<Void> withView(int expectedViewId)
- Specified by:
withView
in interfaceTransport
- Returns:
- A
CompletableFuture
that completes when the transport has installed the expected view.
-
waitForView
public void waitForView(int viewId) throws InterruptedException
- Specified by:
waitForView
in interfaceTransport
- Throws:
InterruptedException
-
checkTotalOrderSupported
public void checkTotalOrderSupported()
Description copied from interface:Transport
check if the transport has configured with total order deliver properties (has the sequencer in JGroups protocol stack.- Specified by:
checkTotalOrderSupported
in interfaceTransport
-
getDelegate
public Transport getDelegate()
-
beforeInvokeRemotely
protected void beforeInvokeRemotely(org.infinispan.commands.ReplicableCommand command)
method invoked before a remote invocation.- Parameters:
command
- the command to be invoked remotely
-
afterInvokeRemotely
protected Map<Address,Response> afterInvokeRemotely(org.infinispan.commands.ReplicableCommand command, Map<Address,Response> responseMap)
method invoked after a successful remote invocation.- Parameters:
command
- the command invoked remotely.responseMap
- can be null if not response is expected.- Returns:
- the new response map
-
beforeBackupRemotely
protected void beforeBackupRemotely(XSiteReplicateCommand command)
method invoked before a backup remote invocation.- Parameters:
command
- the command to be invoked remotely
-
afterBackupRemotely
protected BackupResponse afterBackupRemotely(org.infinispan.commands.ReplicableCommand command, BackupResponse response)
method invoked after a successful backup remote invocation.- Parameters:
command
- the command invoked remotely.response
- can be null if not response is expected.- Returns:
- the new response map
-
getSitesView
public Set<String> getSitesView()
Description copied from interface:Transport
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.- Specified by:
getSitesView
in interfaceTransport
- Returns:
- set containing the connected sites, or null if no cross site replication has been enabled.
-
invokeCommand
public <T> CompletionStage<T> invokeCommand(Address target, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Description copied from interface:Transport
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.- Specified by:
invokeCommand
in interfaceTransport
-
invokeCommand
public <T> CompletionStage<T> invokeCommand(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Description copied from interface:Transport
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.- Specified by:
invokeCommand
in interfaceTransport
-
invokeCommandOnAll
public <T> CompletionStage<T> invokeCommandOnAll(org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Description copied from interface:Transport
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.- Specified by:
invokeCommandOnAll
in interfaceTransport
-
invokeCommandStaggered
public <T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Description copied from interface:Transport
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.- Specified by:
invokeCommandStaggered
in interfaceTransport
-
invokeCommands
public <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,org.infinispan.commands.ReplicableCommand> commandGenerator, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit)
Description copied from interface:Transport
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.- Specified by:
invokeCommands
in interfaceTransport
-
-