Package org.infinispan.remoting.rpc
Interface RpcManager
-
- All Known Implementing Classes:
ExtendedStatisticRpcManager,RpcManagerImpl
public interface RpcManagerProvides a mechanism for communicating with other caches in the cluster, by formatting and passing requests down to the registeredTransport.- Since:
- 4.0
- Author:
- Manik Surtani, Mircea.Markus@jboss.com
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <T> Tblocking(CompletionStage<T> request)Block on a request and return its result.AddressgetAddress()Returns the address associated with this RpcManager or null if not part of the cluster.RpcOptionsgetDefaultRpcOptions(boolean sync)Deprecated.Since 9.2, please usegetSyncRpcOptions()instead.RpcOptionsgetDefaultRpcOptions(boolean sync, DeliverOrder deliverOrder)Deprecated.Since 9.2, please usegetSyncRpcOptions()orgetTotalSyncRpcOptions()instead.List<Address>getMembers()Returns members of a cluster scoped to the cache owning this RpcManager.RpcOptionsBuildergetRpcOptionsBuilder(ResponseMode responseMode)Deprecated.Since 9.2, please usegetSyncRpcOptions()instead.RpcOptionsBuildergetRpcOptionsBuilder(ResponseMode responseMode, DeliverOrder deliverOrder)Deprecated.Since 9.2, please usegetSyncRpcOptions()instead.RpcOptionsgetSyncRpcOptions()intgetTopologyId()Returns the current topology id.RpcOptionsgetTotalSyncRpcOptions()TransportgetTransport()<T> CompletionStage<T>invokeCommand(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)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, RpcOptions rpcOptions)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, RpcOptions rpcOptions)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, RpcOptions rpcOptions)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, RpcOptions rpcOptions)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 rpc, RpcOptions options)Deprecated.Since 9.2, please useinvokeCommand(Collection, ReplicableCommand, ResponseCollector, RpcOptions)instead.Map<Address,Response>invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcs, RpcOptions options)Deprecated.Since 9.2, please useinvokeCommands(Collection, Function, ResponseCollector, RpcOptions)instead.CompletableFuture<Map<Address,Response>>invokeRemotelyAsync(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpc, RpcOptions options)Invokes a command on remote nodes.BackupResponseinvokeXSite(Collection<XSiteBackup> sites, XSiteReplicateCommand command)Invokes theXSiteReplicateCommandto one or more remote sites.voidsendTo(Address destination, org.infinispan.commands.ReplicableCommand command, DeliverOrder deliverOrder)Asynchronously sends theReplicableCommandto the destination using the specifiedDeliverOrder.voidsendToAll(org.infinispan.commands.ReplicableCommand command, DeliverOrder deliverOrder)Asynchronously sends theReplicableCommandto the entire cluster.voidsendToMany(Collection<Address> destinations, org.infinispan.commands.ReplicableCommand command, DeliverOrder deliverOrder)Asynchronously sends theReplicableCommandto the set of destination using the specifiedDeliverOrder.
-
-
-
Method Detail
-
invokeCommand
<T> CompletionStage<T> invokeCommand(Address target, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
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 notDeliverOrder.TOTAL, the command is never executed, andResponseCollector.finish()is called directly.- Since:
- 9.2
-
invokeCommand
<T> CompletionStage<T> invokeCommand(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
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 notDeliverOrder.TOTAL, the command is only executed on the remote nodes.- Since:
- 9.2
-
invokeCommandOnAll
<T> CompletionStage<T> invokeCommandOnAll(org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
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 isDeliverOrder.TOTAL. The command is not sent across RELAY2 bridges to remote sites.- Since:
- 9.2
-
invokeCommandStaggered
<T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, org.infinispan.commands.ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
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 ifResponseCollector.addResponse(Address, Response)returns a non-nullvalue. If one of the targets is the local node and the delivery order is notDeliverOrder.TOTAL, the command is only executed on the remote nodes.- Since:
- 9.2
-
invokeCommands
<T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,org.infinispan.commands.ReplicableCommand> commandGenerator, ResponseCollector<T> collector, RpcOptions rpcOptions)
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 notDeliverOrder.TOTAL, the command is only executed on the remote nodes.- Since:
- 9.2
-
blocking
<T> T blocking(CompletionStage<T> request)
Block on a request and return its result.- Since:
- 9.2
-
invokeRemotelyAsync
CompletableFuture<Map<Address,Response>> invokeRemotelyAsync(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpc, RpcOptions options)
Invokes a command on remote nodes.- Parameters:
recipients- A list of nodes, ornullto invoke the command on all the members of the clusterrpc- The command to invokeoptions- The invocation options- Returns:
- A future that, when completed, returns the responses from the remote nodes.
-
invokeRemotely
@Deprecated Map<Address,Response> invokeRemotely(Collection<Address> recipients, org.infinispan.commands.ReplicableCommand rpc, RpcOptions options)
Deprecated.Since 9.2, please useinvokeCommand(Collection, ReplicableCommand, ResponseCollector, RpcOptions)instead.Invokes an RPC call on other caches in the cluster.- Parameters:
recipients- a list of Addresses to invoke the call on. If this isnull, 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 sinceRpcManagerdoes not change it. Any change inRpcOptionsduring a remote invocation can lead to unpredictable behavior.- Returns:
- a map of responses from each member contacted.
-
invokeRemotely
@Deprecated Map<Address,Response> invokeRemotely(Map<Address,org.infinispan.commands.ReplicableCommand> rpcs, RpcOptions options)
Deprecated.Since 9.2, please useinvokeCommands(Collection, Function, ResponseCollector, RpcOptions)instead.
-
sendTo
void sendTo(Address destination, org.infinispan.commands.ReplicableCommand command, DeliverOrder deliverOrder)
Asynchronously sends theReplicableCommandto the destination using the specifiedDeliverOrder.- Parameters:
destination- the destination'sAddress.command- theReplicableCommandto send.deliverOrder- theDeliverOrderto use.
-
sendToMany
void sendToMany(Collection<Address> destinations, org.infinispan.commands.ReplicableCommand command, DeliverOrder deliverOrder)
Asynchronously sends theReplicableCommandto the set of destination using the specifiedDeliverOrder.- Parameters:
destinations- the collection of destination'sAddress. Ifnull, it sends to all the members in the cluster.command- theReplicableCommandto send.deliverOrder- theDeliverOrderto use.
-
sendToAll
void sendToAll(org.infinispan.commands.ReplicableCommand command, DeliverOrder deliverOrder)Asynchronously sends theReplicableCommandto the entire cluster.- Since:
- 9.2
-
invokeXSite
BackupResponse invokeXSite(Collection<XSiteBackup> sites, XSiteReplicateCommand command) throws Exception
Invokes theXSiteReplicateCommandto one or more remote sites.- Parameters:
sites- The sites to where the command is sent.command- TheXSiteReplicateCommandto send.- Returns:
- The
BackupResponsewith the responses. - Throws:
Exception
-
getTransport
Transport getTransport()
- Returns:
- a reference to the underlying transport.
-
getMembers
List<Address> getMembers()
Returns members of a cluster scoped to the cache owning this RpcManager. Note that this List is always a subset ofTransport.getMembers()- Returns:
- a list of cache scoped cluster members
-
getAddress
Address getAddress()
Returns the address associated with this RpcManager or null if not part of the cluster.
-
getTopologyId
int getTopologyId()
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.
-
getSyncRpcOptions
RpcOptions getSyncRpcOptions()
- Returns:
- The default options for synchronous remote invocations.
-
getTotalSyncRpcOptions
RpcOptions getTotalSyncRpcOptions()
- Returns:
- The default options for total order remote invocations.
-
getRpcOptionsBuilder
@Deprecated RpcOptionsBuilder getRpcOptionsBuilder(ResponseMode responseMode)
Deprecated.Since 9.2, please usegetSyncRpcOptions()instead.Creates a newRpcOptionsBuilder. TheRpcOptionsBuilderis configured with theResponseModeand withDeliverOrder.NONEif theResponseModeis synchronous otherwise, withDeliverOrder.PER_SENDERif asynchronous.- Parameters:
responseMode- theResponseMode.- Returns:
- a new
RpcOptionsBuilderwith the default options. The response and deliver mode are set as described.
-
getRpcOptionsBuilder
@Deprecated RpcOptionsBuilder getRpcOptionsBuilder(ResponseMode responseMode, DeliverOrder deliverOrder)
Deprecated.Since 9.2, please usegetSyncRpcOptions()instead.Creates a newRpcOptionsBuilder.- Parameters:
responseMode- theResponseMode.deliverOrder- theDeliverOrder.- Returns:
- a new
RpcOptionsBuilderwith the default options and the response mode and deliver mode set by the parameters.
-
getDefaultRpcOptions
@Deprecated RpcOptions getDefaultRpcOptions(boolean sync)
Deprecated.Since 9.2, please usegetSyncRpcOptions()instead.Creates a newRpcOptionsBuilder. TheRpcOptionsBuilderis configured withDeliverOrder.NONEif the {@param sync} istrueotherwise, withDeliverOrder.PER_SENDER.- Parameters:
sync-truefor Synchronous RpcOptions- Returns:
- the default Synchronous/Asynchronous RpcOptions
-
getDefaultRpcOptions
@Deprecated RpcOptions getDefaultRpcOptions(boolean sync, DeliverOrder deliverOrder)
Deprecated.Since 9.2, please usegetSyncRpcOptions()orgetTotalSyncRpcOptions()instead.Creates a newRpcOptionsBuilder.- Parameters:
sync-truefor Synchronous RpcOptionsdeliverOrder- theDeliverOrderto use.- Returns:
- the default Synchronous/Asynchronous RpcOptions with the deliver order set by the parameter.
-
-