@MBean(objectName="RpcManager", description="Manages all remote calls to remote cache instances in the cluster.") public class RpcManagerImpl extends Object implements RpcManager, JmxStatisticsExposer
Transport
implementation,
and is used to set up the transport and provide lifecycle and dependency hooks into external transport
implementations.Constructor and Description |
---|
RpcManagerImpl() |
Modifier and Type | Method and Description |
---|---|
<T> T |
blocking(CompletionStage<T> request)
Block on a request and return its result.
|
Address |
getAddress()
Returns the address associated with this RpcManager or null if not part of the cluster.
|
long |
getAverageReplicationTime() |
long |
getAverageXSiteReplicationTime() |
String |
getCommittedViewAsString() |
long |
getMaximumXSiteReplicationTime() |
List<Address> |
getMembers()
Returns members of a cluster scoped to the cache owning this RpcManager.
|
long |
getMinimumXSiteReplicationTime() |
long |
getNumberXSiteRequests() |
String |
getPendingViewAsString() |
long |
getReplicationCount() |
long |
getReplicationFailures() |
String |
getSitesView() |
boolean |
getStatisticsEnabled()
Returns whether an interceptor's statistics are being captured.
|
String |
getSuccessRatio() |
double |
getSuccessRatioFloatingPoint() |
RpcOptions |
getSyncRpcOptions() |
int |
getTopologyId()
Returns the current topology id.
|
Transport |
getTransport() |
<T> CompletionStage<T> |
invokeCommand(Address target,
ReplicableCommand command,
ResponseCollector<T> collector,
RpcOptions rpcOptions)
Invoke a command on a single node and pass the response to a
ResponseCollector . |
<T> CompletionStage<T> |
invokeCommand(Collection<Address> targets,
ReplicableCommand command,
ResponseCollector<T> collector,
RpcOptions rpcOptions)
Invoke a command on a collection of node and pass the responses to a
ResponseCollector . |
<T> CompletionStage<T> |
invokeCommandOnAll(ReplicableCommand command,
ResponseCollector<T> collector,
RpcOptions rpcOptions)
Invoke a command on all the nodes in the cluster and pass the responses to a
ResponseCollector . |
<T> CompletionStage<T> |
invokeCommands(Collection<Address> targets,
Function<Address,ReplicableCommand> commandGenerator,
ResponseCollector<T> collector,
RpcOptions rpcOptions)
Invoke different commands on a collection of nodes and pass the responses to a
ResponseCollector . |
<T> CompletionStage<T> |
invokeCommandStaggered(Collection<Address> targets,
ReplicableCommand command,
ResponseCollector<T> collector,
RpcOptions rpcOptions)
Invoke a command on a collection of nodes and pass the responses to a
ResponseCollector . |
CompletableFuture<Map<Address,Response>> |
invokeRemotelyAsync(Collection<Address> recipients,
ReplicableCommand rpc,
RpcOptions options)
Invokes a command on remote nodes.
|
XSiteResponse |
invokeXSite(XSiteBackup backup,
XSiteReplicateCommand command)
Sends the
XSiteReplicateCommand to a remote site. |
boolean |
isStatisticsEnabled() |
void |
resetStatistics()
Resets an interceptor's cache statistics
|
void |
sendTo(Address destination,
ReplicableCommand command,
DeliverOrder deliverOrder)
Asynchronously sends the
ReplicableCommand to the destination using the specified DeliverOrder . |
void |
sendToAll(ReplicableCommand command,
DeliverOrder deliverOrder)
Asynchronously sends the
ReplicableCommand to the entire cluster. |
void |
sendToMany(Collection<Address> destinations,
ReplicableCommand command,
DeliverOrder deliverOrder)
Asynchronously sends the
ReplicableCommand to the set of destination using the specified DeliverOrder . |
void |
setStatisticsEnabled(boolean statisticsEnabled)
Deprecated.
We already have an attribute, we shouldn't have an operation for the same thing.
|
void |
setTransport(Transport t) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTotalSyncRpcOptions
@ManagedAttribute(description="Retrieves the committed view.", displayName="Committed view", dataType=TRAIT) public String getCommittedViewAsString()
@ManagedAttribute(description="Retrieves the pending view.", displayName="Pending view", dataType=TRAIT) public String getPendingViewAsString()
public <T> CompletionStage<T> invokeCommand(Address target, ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
RpcManager
ResponseCollector
.
If the target is the local node, the command is never executed and ResponseCollector.finish()
is called directly.invokeCommand
in interface RpcManager
public <T> CompletionStage<T> invokeCommand(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
RpcManager
ResponseCollector
.
If one of the targets is the local node, it is ignored. The command is only executed on the remote nodes.invokeCommand
in interface RpcManager
public <T> CompletionStage<T> invokeCommandOnAll(ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
RpcManager
ResponseCollector
.
The command is not executed locally and it is not sent across RELAY2 bridges to remote sites.invokeCommandOnAll
in interface RpcManager
public <T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions)
RpcManager
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.invokeCommandStaggered
in interface RpcManager
public <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,ReplicableCommand> commandGenerator, ResponseCollector<T> collector, RpcOptions rpcOptions)
RpcManager
ResponseCollector
.
The command is only executed on the remote nodes and it is not executed in the local node even if it is in the targets
.invokeCommands
in interface RpcManager
public <T> T blocking(CompletionStage<T> request)
RpcManager
blocking
in interface RpcManager
public CompletableFuture<Map<Address,Response>> invokeRemotelyAsync(Collection<Address> recipients, ReplicableCommand rpc, RpcOptions options)
RpcManager
invokeRemotelyAsync
in interface RpcManager
recipients
- A list of nodes, or null
to invoke the command on all the members of the clusterrpc
- The command to invokeoptions
- The invocation optionspublic void sendTo(Address destination, ReplicableCommand command, DeliverOrder deliverOrder)
RpcManager
ReplicableCommand
to the destination using the specified DeliverOrder
.sendTo
in interface RpcManager
destination
- the destination's Address
.command
- the ReplicableCommand
to send.deliverOrder
- the DeliverOrder
to use.public void sendToMany(Collection<Address> destinations, ReplicableCommand command, DeliverOrder deliverOrder)
RpcManager
ReplicableCommand
to the set of destination using the specified DeliverOrder
.sendToMany
in interface RpcManager
destinations
- the collection of destination's Address
. If null
, it sends to all the members
in the cluster.command
- the ReplicableCommand
to send.deliverOrder
- the DeliverOrder
to use.public void sendToAll(ReplicableCommand command, DeliverOrder deliverOrder)
RpcManager
ReplicableCommand
to the entire cluster.sendToAll
in interface RpcManager
public XSiteResponse invokeXSite(XSiteBackup backup, XSiteReplicateCommand command)
RpcManager
XSiteReplicateCommand
to a remote site.
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
.
invokeXSite
in interface RpcManager
backup
- The site to where the command is sent.command
- The command to send.XSiteResponse
that is completed when the request is completed.public Transport getTransport()
getTransport
in interface RpcManager
@ManagedOperation(description="Resets statistics gathered by this component", displayName="Reset statistics") public void resetStatistics()
JmxStatisticsExposer
resetStatistics
in interface JmxStatisticsExposer
@ManagedAttribute(description="Number of successful replications", displayName="Number of successful replications", measurementType=TRENDSUP) public long getReplicationCount()
@ManagedAttribute(description="Number of failed replications", displayName="Number of failed replications", measurementType=TRENDSUP) public long getReplicationFailures()
@ManagedAttribute(description="Enables or disables the gathering of statistics by this component", displayName="Statistics enabled", dataType=TRAIT, writable=true) public boolean isStatisticsEnabled()
public boolean getStatisticsEnabled()
JmxStatisticsExposer
getStatisticsEnabled
in interface JmxStatisticsExposer
@Deprecated @ManagedOperation(displayName="Enable/disable statistics. Deprecated, use the statisticsEnabled attribute instead.") public void setStatisticsEnabled(@Parameter(name="enabled",description="Whether statistics should be enabled or disabled (true/false)") boolean statisticsEnabled)
JmxStatisticsExposer
setStatisticsEnabled
in interface JmxStatisticsExposer
statisticsEnabled
- true if statistics should be captured@ManagedAttribute(description="Successful replications as a ratio of total replications", displayName="Successful replications ratio") public String getSuccessRatio()
@ManagedAttribute(description="Successful replications as a ratio of total replications in numeric double format", displayName="Successful replication ratio", units=PERCENTAGE) public double getSuccessRatioFloatingPoint()
@ManagedAttribute(description="The average time spent in the transport layer, in milliseconds", displayName="Average time spent in the transport layer", units=MILLISECONDS) public long getAverageReplicationTime()
@ManagedAttribute(description="Retrieves the x-site view.", displayName="Cross site (x-site) view", dataType=TRAIT) public String getSitesView()
@ManagedAttribute(description="Returns the average replication time, in milliseconds, for a cross-site replication request", displayName="Average Cross-Site replication time", units=MILLISECONDS) public long getAverageXSiteReplicationTime()
@ManagedAttribute(description="Returns the minimum replication time, in milliseconds, for a cross-site replication request", displayName="Minimum Cross-Site replication time", units=MILLISECONDS) public long getMinimumXSiteReplicationTime()
@ManagedAttribute(description="Returns the maximum replication time, in milliseconds, for a cross-site replication request", displayName="Minimum Cross-Site replication time", units=MILLISECONDS) public long getMaximumXSiteReplicationTime()
@ManagedAttribute(description="Returns the number of sync cross-site requests", displayName="Cross-Site replication requests") public long getNumberXSiteRequests()
public void setTransport(Transport t)
public Address getAddress()
RpcManager
getAddress
in interface RpcManager
public int getTopologyId()
RpcManager
getTopologyId
in interface RpcManager
public RpcOptions getSyncRpcOptions()
getSyncRpcOptions
in interface RpcManager
public List<Address> getMembers()
RpcManager
Transport.getMembers()
getMembers
in interface RpcManager
Copyright © 2021 JBoss by Red Hat. All rights reserved.