Interface RpcManager
- All Known Implementing Classes:
RpcManagerImpl
public interface RpcManager
Provides a mechanism for communicating with other caches in the cluster, by formatting and passing requests down to
the registered
Transport.- Since:
- 4.0
- Author:
- Manik Surtani, Mircea.Markus@jboss.com
-
Method Summary
Modifier and TypeMethodDescription<T> Tblocking(CompletionStage<T> request) Block on a request and return its result.Returns the address associated with this RpcManager or null if not part of the cluster.Returns members of a cluster scoped to the cache owning this RpcManager.intReturns the current topology id.default RpcOptions<T> CompletionStage<T> invokeCommand(Collection<Address> targets, org.infinispan.commands.remote.CacheRpcCommand command, ResponseCollector<Address, 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.remote.CacheRpcCommand command, ResponseCollector<Address, T> collector, RpcOptions rpcOptions) Invoke a command on a single node and pass the response to aResponseCollector.<T> CompletionStage<T> invokeCommandOnAll(org.infinispan.commands.remote.CacheRpcCommand command, ResponseCollector<Address, 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.remote.CacheRpcCommand> commandGenerator, ResponseCollector<Address, 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.remote.CacheRpcCommand command, ResponseCollector<Address, T> collector, RpcOptions rpcOptions) Invoke a command on a collection of nodes and pass the responses to aResponseCollector.<O> XSiteResponse<O> invokeXSite(org.infinispan.xsite.XSiteBackup backup, XSiteCacheRequest<O> command) Sends theXSiteCacheRequestto a remote site.voidsendTo(Address destination, org.infinispan.commands.remote.CacheRpcCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Asynchronously sends theReplicableCommandto the destination using the specifiedDeliverOrder.voidsendToAll(org.infinispan.commands.remote.CacheRpcCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Asynchronously sends theReplicableCommandto the entire cluster.voidsendToMany(Collection<Address> destinations, org.infinispan.commands.remote.CacheRpcCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Asynchronously sends theReplicableCommandto the set of destination using the specifiedDeliverOrder.
-
Method Details
-
invokeCommand
<T> CompletionStage<T> invokeCommand(Address target, org.infinispan.commands.remote.CacheRpcCommand command, ResponseCollector<Address, T> collector, RpcOptions rpcOptions) Invoke a command on a single node and pass the response to aResponseCollector. If the target is the local node, the command is never executed andResponseCollector.finish()is called directly.- Since:
- 9.2
-
invokeCommand
<T> CompletionStage<T> invokeCommand(Collection<Address> targets, org.infinispan.commands.remote.CacheRpcCommand command, ResponseCollector<Address, 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 node, it is ignored. The command is only executed on the remote nodes.- Since:
- 9.2
-
invokeCommandOnAll
<T> CompletionStage<T> invokeCommandOnAll(org.infinispan.commands.remote.CacheRpcCommand command, ResponseCollector<Address, T> collector, RpcOptions rpcOptions) Invoke a command on all the nodes in the cluster and pass the responses to aResponseCollector. The command is not executed locally and it is not sent across RELAY2 bridges to remote sites.- Since:
- 9.2
-
invokeCommandStaggered
<T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, org.infinispan.commands.remote.CacheRpcCommand command, ResponseCollector<Address, 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(Object, Response)returns a non-nullvalue. 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.remote.CacheRpcCommand> commandGenerator, ResponseCollector<Address, T> collector, RpcOptions rpcOptions) Invoke different commands on a collection of nodes and pass the responses to aResponseCollector. The command is only executed on the remote nodes and it is not executed in the local node even if it is in thetargets.- Since:
- 9.2
-
blocking
-
sendTo
void sendTo(Address destination, org.infinispan.commands.remote.CacheRpcCommand command, org.infinispan.remoting.inboundhandler.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.remote.CacheRpcCommand command, org.infinispan.remoting.inboundhandler.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.remote.CacheRpcCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Asynchronously sends theReplicableCommandto the entire cluster.- Since:
- 9.2
-
invokeXSite
<O> XSiteResponse<O> invokeXSite(org.infinispan.xsite.XSiteBackup backup, XSiteCacheRequest<O> command) Sends theXSiteCacheRequestto a remote site.If
XSiteBackup.isSync()returnsfalse, theXSiteResponseis only completed when the an ACK from the remote site is received. The invoker needs to make sure not to wait for theXSiteResponse.- Parameters:
backup- The site to where the command is sent.command- The command to send.- Returns:
- A
XSiteResponsethat is completed when the request is completed.
-
getTransport
Transport getTransport()- Returns:
- a reference to the underlying transport.
-
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
- Returns:
- The default options for total order remote invocations.
-