Class JGroupsTransport
- All Implemented Interfaces:
Lifecycle
,Transport
,org.jgroups.ChannelListener
,org.jgroups.stack.AddressGenerator
- configurationString - a JGroups configuration String
- configurationXml - JGroups configuration XML as a String
- configurationFile - String pointing to a JGroups XML configuration file
- channelLookup - Fully qualified class name of a
JGroupsChannelLookup
instance
TransportConfigurationBuilder.withProperties(Properties)
or
in the Infinispan XML configuration file.- Since:
- 4.0
- Author:
- Manik Surtani, Galder ZamarreƱo
-
Field Summary
Modifier and TypeFieldDescriptionprotected Address
protected org.jgroups.JChannel
static final String
static final String
protected boolean
protected ClusterView
protected GlobalConfiguration
static final String
static final String
static final String
protected boolean
static final String
protected static final String
protected boolean
protected org.infinispan.remoting.inboundhandler.InboundInvocationHandler
protected CacheManagerJmxRegistration
static final org.infinispan.util.logging.Log
protected StreamingMarshaller
protected JGroupsMetricsManager
protected ExecutorService
protected CacheManagerNotifier
protected Address
protected TypedProperties
static final short
static final short
static final short
static final short
static final short
static final String
protected ScheduledExecutorService
protected TimeService
-
Constructor Summary
ConstructorDescriptionJGroupsTransport
(org.jgroups.JChannel channel) This form is used when the transport is created by an external source and passed in to the GlobalConfiguration. -
Method Summary
Modifier and TypeMethodDescription<O> XSiteResponse
<O> backupRemotely
(org.infinispan.xsite.XSiteBackup backup, XSiteRequest<O> rpcCommand) Sends a cross-site request to a remote site.void
channelClosed
(org.jgroups.JChannel channel) void
channelConnected
(org.jgroups.JChannel channel) void
channelDisconnected
(org.jgroups.JChannel channel) void
Checks if thisTransport
is able to perform cross-site requests.static org.jgroups.protocols.FORK
findFork
(org.jgroups.JChannel channel) org.jgroups.Address
org.jgroups.Address
generateAddress
(String name) Retrieves the current cache instance's network addressorg.jgroups.JChannel
org.infinispan.util.logging.Log
getLog()
Returns a list of members in the current cluster view.Returns physical addresses of members in the current cluster view.Retrieves the current cache instance's physical network addresses.Get the view of interconnected sites.int
protected void
<T> CompletionStage
<T> invokeCommand
(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Invoke a command on a collection of node and pass the responses to aResponseCollector
.<T> CompletionStage
<T> invokeCommand
(Address target, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Invoke a command on a single node and pass the response to aResponseCollector
.<T> CompletionStage
<T> invokeCommandOnAll
(Collection<Address> requiredTargets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Invoke a command on all the nodes in the cluster and pass the responses to aResponseCollector
.<T> CompletionStage
<T> invokeCommandOnAll
(ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) 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, ReplicableCommand> commandGenerator, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit) Invoke different commands on a collection of nodes and pass the responses to aResponseCollector
.<T> CompletionStage
<T> invokeCommandStaggered
(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Invoke a command on a collection of nodes and pass the responses to aResponseCollector
.invokeRemotely
(Map<Address, ReplicableCommand> commands, ResponseMode mode, long timeout, ResponseFilter responseFilter, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, boolean anycast) Deprecated, for removal: This API element is subject to removal in a future version.invokeRemotelyAsync
(Collection<Address> recipients, ReplicableCommand command, ResponseMode mode, long timeout, ResponseFilter responseFilter, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, boolean anycast) boolean
boolean
Tests whether the transport supports true multicastboolean
boolean
org.infinispan.remoting.transport.raft.RaftManager
protected void
receiveClusterView
(org.jgroups.View newView, boolean installIfFirst) void
sendTo
(Address destination, ReplicableCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Asynchronously sends theReplicableCommand
to the destination using the specifiedDeliverOrder
.void
sendToAll
(ReplicableCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Asynchronously sends theReplicableCommand
to the entire cluster.void
sendToMany
(Collection<Address> targets, ReplicableCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Asynchronously sends theReplicableCommand
to the set of destination using the specifiedDeliverOrder
.void
start()
Invoked on component startprotected void
When overwriting this method, it allows third-party libraries to create a new behavior like: AfterJChannel
has been created and before it is connected.void
stop()
Invoked on component stopwithView
(int expectedViewId) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.remoting.transport.Transport
checkTotalOrderSupported, invokeCommands, invokeRemotely
-
Field Details
-
CONFIGURATION_STRING
- See Also:
-
CONFIGURATION_XML
- See Also:
-
CONFIGURATION_FILE
- See Also:
-
CHANNEL_LOOKUP
- See Also:
-
CHANNEL_CONFIGURATOR
- See Also:
-
SOCKET_FACTORY
- See Also:
-
DATA_SOURCE
- See Also:
-
REQUEST_FLAGS_UNORDERED
public static final short REQUEST_FLAGS_UNORDERED -
REQUEST_FLAGS_UNORDERED_NO_FC
public static final short REQUEST_FLAGS_UNORDERED_NO_FC -
REQUEST_FLAGS_PER_SENDER
public static final short REQUEST_FLAGS_PER_SENDER -
REQUEST_FLAGS_PER_SENDER_NO_FC
public static final short REQUEST_FLAGS_PER_SENDER_NO_FC -
REPLY_FLAGS
public static final short REPLY_FLAGS -
DEFAULT_JGROUPS_CONFIGURATION_FILE
- See Also:
-
log
public static final org.infinispan.util.logging.Log log -
configuration
-
marshaller
-
notifier
-
timeService
-
invocationHandler
protected org.infinispan.remoting.inboundhandler.InboundInvocationHandler invocationHandler -
timeoutExecutor
-
nonBlockingExecutor
-
jmxRegistration
-
metricsManager
-
connectChannel
protected boolean connectChannel -
disconnectChannel
protected boolean disconnectChannel -
closeChannel
protected boolean closeChannel -
props
-
channel
protected org.jgroups.JChannel channel -
address
-
physicalAddress
-
clusterView
-
-
Constructor Details
-
JGroupsTransport
public JGroupsTransport(org.jgroups.JChannel channel) This form is used when the transport is created by an external source and passed in to the GlobalConfiguration.- Parameters:
channel
- created and running channel to use
-
JGroupsTransport
public JGroupsTransport()
-
-
Method Details
-
findFork
public static org.jgroups.protocols.FORK findFork(org.jgroups.JChannel channel) -
invokeRemotelyAsync
public CompletableFuture<Map<Address,Response>> invokeRemotelyAsync(Collection<Address> recipients, ReplicableCommand command, ResponseMode mode, long timeout, ResponseFilter responseFilter, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, boolean anycast) - Specified by:
invokeRemotelyAsync
in interfaceTransport
-
sendTo
public void sendTo(Address destination, ReplicableCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Description copied from interface:Transport
Asynchronously sends theReplicableCommand
to the destination using the specifiedDeliverOrder
.- Specified by:
sendTo
in interfaceTransport
- Parameters:
destination
- the destination'sAddress
.command
- theReplicableCommand
to send.deliverOrder
- theDeliverOrder
to use.
-
sendToMany
public void sendToMany(Collection<Address> targets, ReplicableCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Description copied from interface:Transport
Asynchronously sends theReplicableCommand
to the set of destination using the specifiedDeliverOrder
.- Specified by:
sendToMany
in interfaceTransport
- Parameters:
targets
- the collection of destination'sAddress
. Ifnull
, it sends to all the members in the cluster.command
- theReplicableCommand
to send.deliverOrder
- theDeliverOrder
to use.
-
invokeRemotely
@Deprecated(forRemoval=true) public Map<Address,Response> invokeRemotely(Map<Address, ReplicableCommand> commands, ResponseMode mode, long timeout, ResponseFilter responseFilter, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, boolean anycast) throws ExceptionDeprecated, for removal: This API element is subject to removal in a future version.- Specified by:
invokeRemotely
in interfaceTransport
- Throws:
Exception
-
backupRemotely
public <O> XSiteResponse<O> backupRemotely(org.infinispan.xsite.XSiteBackup backup, XSiteRequest<O> rpcCommand) Description copied from interface:Transport
Sends a cross-site request to a remote site.Currently, no reply values are supported. Or the request completes successfully or it throws an
Exception
.If
XSiteBackup.isSync()
returnsfalse
, theXSiteResponse
is only completed when the an ACK from the remote site is received. The invoker needs to make sure not to wait for theXSiteResponse
.- Specified by:
backupRemotely
in interfaceTransport
- Parameters:
backup
- The remote site.rpcCommand
- The command to send.- Returns:
- A
XSiteResponse
that is completed when the request is completed.
-
isCoordinator
public boolean isCoordinator()- Specified by:
isCoordinator
in interfaceTransport
- Returns:
- true if the current Channel is the coordinator of the cluster.
-
getCoordinator
- Specified by:
getCoordinator
in interfaceTransport
- Returns:
- the Address of the current coordinator.
-
getAddress
Description copied from interface:Transport
Retrieves the current cache instance's network address- Specified by:
getAddress
in interfaceTransport
- Returns:
- an Address
-
getPhysicalAddresses
Description copied from interface:Transport
Retrieves the current cache instance's physical network addresses. Some implementations might differentiate between logical and physical addresses in which case, this method allows clients to query the physical ones associated with the logical address. Implementations where logical and physical address are the same will simply return a single entry List that contains the same Address asTransport.getAddress()
.- Specified by:
getPhysicalAddresses
in interfaceTransport
- Returns:
- an List of Address
-
getMembers
Description copied from interface:Transport
Returns a list of members in the current cluster view.- Specified by:
getMembers
in interfaceTransport
- Returns:
- a list of members. Typically, this would be defensively copied.
-
getMembersPhysicalAddresses
Description copied from interface:Transport
Returns physical addresses of members in the current cluster view.- Specified by:
getMembersPhysicalAddresses
in interfaceTransport
- Returns:
- a list of physical addresses
-
isMulticastCapable
public boolean isMulticastCapable()Description copied from interface:Transport
Tests whether the transport supports true multicast- Specified by:
isMulticastCapable
in interfaceTransport
- Returns:
- true if the transport supports true multicast
-
checkCrossSiteAvailable
Description copied from interface:Transport
Checks if thisTransport
is able to perform cross-site requests.- Specified by:
checkCrossSiteAvailable
in interfaceTransport
- Throws:
CacheConfigurationException
- if cross-site isn't available.
-
localSiteName
- Specified by:
localSiteName
in interfaceTransport
- Returns:
- The local site name or
null
if thisTransport
cannot make cross-site requests.
-
localNodeName
- Specified by:
localNodeName
in interfaceTransport
- Returns:
- The local node name, defaults to the local node address.
-
start
public void start()Description copied from interface:Lifecycle
Invoked on component start -
initChannel
protected void initChannel() -
startJGroupsChannelIfNeeded
protected void startJGroupsChannelIfNeeded()When overwriting this method, it allows third-party libraries to create a new behavior like: AfterJChannel
has been created and before it is connected. -
receiveClusterView
protected void receiveClusterView(org.jgroups.View newView, boolean installIfFirst) -
stop
public void stop()Description copied from interface:Lifecycle
Invoked on component stop -
getViewId
public int getViewId() -
withView
- Specified by:
withView
in interfaceTransport
- Returns:
- A
CompletableFuture
that completes when the transport has installed the expected view.
-
getLog
public org.infinispan.util.logging.Log getLog() -
getSitesView
Description copied from interface:Transport
Get the view of interconnected sites. If no cross site replication has been configured, this method returns null. Inspecting the site view can be useful to see if the different sites have managed to join each other, which is pre-requisite to get cross replication working.- Specified by:
getSitesView
in interfaceTransport
- Returns:
- set containing the connected sites, or null if no cross site replication has been enabled.
-
isSiteCoordinator
public boolean isSiteCoordinator()- Specified by:
isSiteCoordinator
in interfaceTransport
- Returns:
true
if this node is a cross-site replication coordinator.
-
getRelayNodesAddress
- Specified by:
getRelayNodesAddress
in interfaceTransport
- Returns:
- The current site coordinators
Address
.
-
isPrimaryRelayNode
public boolean isPrimaryRelayNode()- Specified by:
isPrimaryRelayNode
in interfaceTransport
-
invokeCommand
public <T> CompletionStage<T> invokeCommand(Address target, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Description copied from interface:Transport
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 and
ResponseCollector.finish()
is called directly.- Specified by:
invokeCommand
in interfaceTransport
-
invokeCommand
public <T> CompletionStage<T> invokeCommand(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Description copied from interface:Transport
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.
- Specified by:
invokeCommand
in interfaceTransport
-
invokeCommandOnAll
public <T> CompletionStage<T> invokeCommandOnAll(ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Description copied from interface:Transport
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.
- Specified by:
invokeCommandOnAll
in interfaceTransport
-
invokeCommandOnAll
public <T> CompletionStage<T> invokeCommandOnAll(Collection<Address> requiredTargets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Description copied from interface:Transport
Invoke a command on all the nodes in the cluster and pass the responses to aResponseCollector
.he command is not executed locally and it is not sent across RELAY2 bridges to remote sites.
- Specified by:
invokeCommandOnAll
in interfaceTransport
-
invokeCommandStaggered
public <T> CompletionStage<T> invokeCommandStaggered(Collection<Address> targets, ReplicableCommand command, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit unit) Description copied from interface:Transport
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 if
ResponseCollector.addResponse(Address, Response)
returns a non-null
value.The command is only executed on the remote nodes.
- Specified by:
invokeCommandStaggered
in interfaceTransport
-
invokeCommands
public <T> CompletionStage<T> invokeCommands(Collection<Address> targets, Function<Address, ReplicableCommand> commandGenerator, ResponseCollector<T> collector, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder, long timeout, TimeUnit timeUnit) Description copied from interface:Transport
Invoke different commands on a collection of nodes and pass the responses to aResponseCollector
.The command is only executed on the remote nodes.
- Specified by:
invokeCommands
in interfaceTransport
-
raftManager
public org.infinispan.remoting.transport.raft.RaftManager raftManager()- Specified by:
raftManager
in interfaceTransport
- Returns:
- The
RaftManager
instance,
-
sendToAll
public void sendToAll(ReplicableCommand command, org.infinispan.remoting.inboundhandler.DeliverOrder deliverOrder) Description copied from interface:Transport
Asynchronously sends theReplicableCommand
to the entire cluster. -
getChannel
public org.jgroups.JChannel getChannel() -
channelConnected
public void channelConnected(org.jgroups.JChannel channel) - Specified by:
channelConnected
in interfaceorg.jgroups.ChannelListener
-
channelDisconnected
public void channelDisconnected(org.jgroups.JChannel channel) - Specified by:
channelDisconnected
in interfaceorg.jgroups.ChannelListener
-
channelClosed
public void channelClosed(org.jgroups.JChannel channel) - Specified by:
channelClosed
in interfaceorg.jgroups.ChannelListener
-
generateAddress
public org.jgroups.Address generateAddress()- Specified by:
generateAddress
in interfaceorg.jgroups.stack.AddressGenerator
-
generateAddress
- Specified by:
generateAddress
in interfaceorg.jgroups.stack.AddressGenerator
-