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, wait
checkTotalOrderSupported, invokeCommands, invokeRemotely, invokeRemotely
public 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 Transport
public void sendTo(Address destination, ReplicableCommand command, DeliverOrder deliverOrder)
Transport
ReplicableCommand
to the destination using the specified DeliverOrder
.sendTo
in interface Transport
destination
- the destination's Address
.command
- the ReplicableCommand
to send.deliverOrder
- the DeliverOrder
to use.public void sendToMany(Collection<Address> targets, ReplicableCommand command, DeliverOrder deliverOrder)
Transport
ReplicableCommand
to the set of destination using the specified DeliverOrder
.sendToMany
in interface Transport
targets
- 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 Transport
Exception
public BackupResponse backupRemotely(Collection<XSiteBackup> backups, XSiteReplicateCommand command)
backupRemotely
in interface Transport
public 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 Transport
backup
- The remote site.rpcCommand
- The command to send.XSiteResponse
that is completed when the request is completed.public boolean isCoordinator()
isCoordinator
in interface Transport
public Address getCoordinator()
getCoordinator
in interface Transport
public Address getAddress()
Transport
getAddress
in interface Transport
public List<Address> getPhysicalAddresses()
Transport
Transport.getAddress()
.getPhysicalAddresses
in interface Transport
public List<Address> getMembers()
Transport
getMembers
in interface Transport
public List<Address> getMembersPhysicalAddresses()
Transport
getMembersPhysicalAddresses
in interface Transport
public boolean isMulticastCapable()
Transport
isMulticastCapable
in interface Transport
public void checkCrossSiteAvailable() throws CacheConfigurationException
Transport
Transport
is able to perform cross-site requests.checkCrossSiteAvailable
in interface Transport
CacheConfigurationException
- if cross-site isn't available.public String localSiteName()
localSiteName
in interface Transport
null
if this Transport
cannot make cross-site requests.public void start()
Lifecycle
protected void initChannel()
protected void startJGroupsChannelIfNeeded()
JChannel
has been created and before it is connected.protected void receiveClusterView(org.jgroups.View newView)
public void stop()
Lifecycle
public CompletableFuture<Void> withView(int expectedViewId)
withView
in interface Transport
CompletableFuture
that completes when the transport has installed the expected view.public void waitForView(int viewId) throws InterruptedException
waitForView
in interface Transport
InterruptedException
public Set<String> getSitesView()
Transport
getSitesView
in interface Transport
public <T> CompletionStage<T> invokeCommand(Address target, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Transport
ResponseCollector
.
If the target is the local node, the command is never executed and ResponseCollector.finish()
is called directly.
invokeCommand
in interface Transport
public <T> CompletionStage<T> invokeCommand(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Transport
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 Transport
public <T> CompletionStage<T> invokeCommandOnAll(ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Transport
ResponseCollector
.
The command is not executed locally and it is not sent across RELAY2 bridges to remote sites.
invokeCommandOnAll
in interface Transport
public <T> CompletionStage<T> invokeCommandOnAll(Collection<Address> requiredTargets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Transport
ResponseCollector
.
he command is not executed locally and it is not sent across RELAY2 bridges to remote sites.
invokeCommandOnAll
in interface Transport
public <T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit)
Transport
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 Transport
public <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address,ReplicableCommand> commandGenerator, ResponseCollector<T> collector, DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit)
Transport
ResponseCollector
.
The command is only executed on the remote nodes.
invokeCommands
in interface Transport
public void sendToAll(ReplicableCommand command, DeliverOrder deliverOrder)
Transport
ReplicableCommand
to the entire cluster.public org.jgroups.JChannel getChannel()
Copyright © 2021 JBoss by Red Hat. All rights reserved.