public class JGroupsTransport extends Object implements Transport
JGroupsChannelLookup instanceTransportConfigurationBuilder.withProperties(Properties) or
in the Infinispan XML configuration file.| Modifier and Type | Field and Description |
|---|---|
protected Address |
address |
protected org.jgroups.JChannel |
channel |
static String |
CHANNEL_CONFIGURATOR |
static String |
CHANNEL_LOOKUP |
protected boolean |
closeChannel |
protected ClusterView |
clusterView |
protected GlobalConfiguration |
configuration |
static String |
CONFIGURATION_FILE |
static String |
CONFIGURATION_STRING |
static String |
CONFIGURATION_XML |
protected boolean |
connectChannel |
protected static String |
DEFAULT_JGROUPS_CONFIGURATION_FILE |
protected boolean |
disconnectChannel |
protected InboundInvocationHandler |
invocationHandler |
protected CacheManagerJmxRegistration |
jmxRegistration |
static Log |
log |
protected StreamingMarshaller |
marshaller |
protected ExecutorService |
nonBlockingExecutor |
protected CacheManagerNotifier |
notifier |
protected Address |
physicalAddress |
protected TypedProperties |
props |
static short |
REPLY_FLAGS |
protected ScheduledExecutorService |
timeoutExecutor |
protected TimeService |
timeService |
| Constructor and Description |
|---|
JGroupsTransport() |
JGroupsTransport(org.jgroups.JChannel channel)
This form is used when the transport is created by an external source and passed in to the
GlobalConfiguration.
|
| Modifier and Type | Method and Description |
|---|---|
BackupResponse |
backupRemotely(Collection<XSiteBackup> backups,
XSiteReplicateCommand command) |
XSiteResponse |
backupRemotely(XSiteBackup backup,
XSiteReplicateCommand rpcCommand)
Sends a cross-site request to a remote site.
|
void |
checkCrossSiteAvailable()
Checks if this
Transport is able to perform cross-site requests. |
Address |
getAddress()
Retrieves the current cache instance's network address
|
org.jgroups.JChannel |
getChannel() |
Address |
getCoordinator() |
Log |
getLog() |
List<Address> |
getMembers()
Returns a list of members in the current cluster view.
|
List<Address> |
getMembersPhysicalAddresses()
Returns physical addresses 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() |
protected void |
initChannel() |
<T> CompletionStage<T> |
invokeCommand(Address target,
ReplicableCommand command,
ResponseCollector<T> collector,
DeliverOrder deliverOrder,
long timeout,
TimeUnit unit)
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,
DeliverOrder deliverOrder,
long timeout,
TimeUnit unit)
Invoke a command on a collection of node and pass the responses to a
ResponseCollector. |
<T> CompletionStage<T> |
invokeCommandOnAll(Collection<Address> requiredTargets,
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 a
ResponseCollector. |
<T> CompletionStage<T> |
invokeCommandOnAll(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 a
ResponseCollector. |
<T> CompletionStage<T> |
invokeCommands(Collection<Address> targets,
Function<Address,ReplicableCommand> commandGenerator,
ResponseCollector<T> collector,
DeliverOrder deliverOrder,
long timeout,
TimeUnit timeUnit)
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,
DeliverOrder deliverOrder,
long timeout,
TimeUnit unit)
Invoke a command on a collection of nodes and pass the responses to a
ResponseCollector. |
Map<Address,Response> |
invokeRemotely(Map<Address,ReplicableCommand> commands,
ResponseMode mode,
long timeout,
ResponseFilter responseFilter,
DeliverOrder deliverOrder,
boolean anycast)
Deprecated.
|
CompletableFuture<Map<Address,Response>> |
invokeRemotelyAsync(Collection<Address> recipients,
ReplicableCommand command,
ResponseMode mode,
long timeout,
ResponseFilter responseFilter,
DeliverOrder deliverOrder,
boolean anycast) |
boolean |
isCoordinator() |
boolean |
isMulticastCapable()
Tests whether the transport supports true multicast
|
String |
localSiteName() |
protected void |
receiveClusterView(org.jgroups.View newView) |
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> targets,
ReplicableCommand command,
DeliverOrder deliverOrder)
Asynchronously sends the
ReplicableCommand to the set of destination using the specified DeliverOrder. |
void |
start()
Invoked on component start
|
protected void |
startJGroupsChannelIfNeeded()
When overwriting this method, it allows third-party libraries to create a new behavior like:
After
JChannel has been created and before it is connected. |
void |
stop()
Invoked on component stop
|
void |
waitForView(int viewId) |
CompletableFuture<Void> |
withView(int expectedViewId) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckTotalOrderSupported, invokeCommands, invokeRemotely, invokeRemotelypublic static final String CONFIGURATION_STRING
public static final String CONFIGURATION_XML
public static final String CONFIGURATION_FILE
public static final String CHANNEL_LOOKUP
public static final String CHANNEL_CONFIGURATOR
public static final short REPLY_FLAGS
protected static final String DEFAULT_JGROUPS_CONFIGURATION_FILE
public static final Log log
protected GlobalConfiguration configuration
protected StreamingMarshaller marshaller
protected CacheManagerNotifier notifier
protected TimeService timeService
protected InboundInvocationHandler invocationHandler
protected ScheduledExecutorService timeoutExecutor
protected ExecutorService nonBlockingExecutor
protected CacheManagerJmxRegistration jmxRegistration
protected boolean connectChannel
protected boolean disconnectChannel
protected boolean closeChannel
protected TypedProperties props
protected org.jgroups.JChannel channel
protected Address address
protected Address physicalAddress
protected volatile ClusterView clusterView
public JGroupsTransport(org.jgroups.JChannel channel)
channel - created and running channel to usepublic JGroupsTransport()
public CompletableFuture<Map<Address,Response>> invokeRemotelyAsync(Collection<Address> recipients, ReplicableCommand command, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast)
invokeRemotelyAsync in interface Transportpublic void sendTo(Address destination, ReplicableCommand command, DeliverOrder deliverOrder)
TransportReplicableCommand to the destination using the specified DeliverOrder.sendTo in interface Transportdestination - the destination's Address.command - the ReplicableCommand to send.deliverOrder - the DeliverOrder to use.public void sendToMany(Collection<Address> targets, ReplicableCommand command, DeliverOrder deliverOrder)
TransportReplicableCommand to the set of destination using the specified DeliverOrder.sendToMany in interface Transporttargets - 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.@Deprecated public Map<Address,Response> invokeRemotely(Map<Address,ReplicableCommand> commands, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception
invokeRemotely in interface TransportExceptionpublic BackupResponse backupRemotely(Collection<XSiteBackup> backups, XSiteReplicateCommand command)
backupRemotely in interface Transportpublic XSiteResponse backupRemotely(XSiteBackup backup, XSiteReplicateCommand rpcCommand)
Transport
Currently, no reply values are supported. Or the request completes successfully or it throws an Exception.
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.
backupRemotely in interface Transportbackup - The remote site.rpcCommand - The command to send.XSiteResponse that is completed when the request is completed.public boolean isCoordinator()
isCoordinator in interface Transportpublic Address getCoordinator()
getCoordinator in interface Transportpublic Address getAddress()
TransportgetAddress in interface Transportpublic List<Address> getPhysicalAddresses()
TransportTransport.getAddress().getPhysicalAddresses in interface Transportpublic List<Address> getMembers()
TransportgetMembers in interface Transportpublic List<Address> getMembersPhysicalAddresses()
TransportgetMembersPhysicalAddresses in interface Transportpublic boolean isMulticastCapable()
TransportisMulticastCapable in interface Transportpublic void checkCrossSiteAvailable()
throws CacheConfigurationException
TransportTransport is able to perform cross-site requests.checkCrossSiteAvailable in interface TransportCacheConfigurationException - if cross-site isn't available.public String localSiteName()
localSiteName in interface Transportnull if this Transport cannot make cross-site requests.public void start()
Lifecycleprotected void initChannel()
protected void startJGroupsChannelIfNeeded()
JChannel has been created and before it is connected.protected void receiveClusterView(org.jgroups.View newView)
public void stop()
Lifecyclepublic CompletableFuture<Void> withView(int expectedViewId)
withView in interface TransportCompletableFuture that completes when the transport has installed the expected view.public void waitForView(int viewId)
throws InterruptedException
waitForView in interface TransportInterruptedExceptionpublic Set<String> getSitesView()
TransportgetSitesView in interface Transportpublic <T> CompletionStage<T> invokeCommand(Address target, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
TransportResponseCollector.
If the target is the local node, the command is never executed and ResponseCollector.finish() is called directly.
invokeCommand in interface Transportpublic <T> CompletionStage<T> invokeCommand(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
TransportResponseCollector.
If one of the targets is the local node, it is ignored. The command is only executed on the remote nodes.
invokeCommand in interface Transportpublic <T> CompletionStage<T> invokeCommandOnAll(ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
TransportResponseCollector.
The command is not executed locally and it is not sent across RELAY2 bridges to remote sites.
invokeCommandOnAll in interface Transportpublic <T> CompletionStage<T> invokeCommandOnAll(Collection<Address> requiredTargets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
TransportResponseCollector.
he command is not executed locally and it is not sent across RELAY2 bridges to remote sites.
invokeCommandOnAll in interface Transportpublic <T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
TransportResponseCollector.
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 Transportpublic <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,ReplicableCommand> commandGenerator, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit)
TransportResponseCollector.
The command is only executed on the remote nodes.
invokeCommands in interface Transportpublic void sendToAll(ReplicableCommand command, DeliverOrder deliverOrder)
TransportReplicableCommand to the entire cluster.public org.jgroups.JChannel getChannel()
Copyright © 2022 JBoss by Red Hat. All rights reserved.