Class SharedJGroupsTransport
java.lang.Object
org.exoplatform.services.ispn.SharedJGroupsTransport
Lets the JGroups channels of a node share one transport, as the
singleton_name attribute of a JGroups 3
transport did before JGroups 4 removed it: the first channel created for a stack opens a main channel on the
stack's transport, and each channel of that stack is a fork of it, named after its cluster.
A fork's view is its main channel's view, so a member may lack a fork while it starts or stops. A request sent to such a member is answered with an empty response, which Infinispan reads as a cache that is not running there, rather than left to time out (the pattern WildFly uses for its forks). The main channel builds its addresses as Infinispan's transport does, since the forks share them.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property naming the cluster partition, which qualifies the main channel's cluster name, so that two partitions on the same network never share a main channel.static final StringThe attribute of the transport protocol that makes the channels of a stack share one transport. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.jgroups.JChannelcreateChannel(org.jgroups.conf.ProtocolStackConfigurator stack, String clusterName, String nodeName) Creates a channel on the shared transport of a stack, opening the main channel of the stack if no other channel of this node uses it.static StringgetSingletonName(org.jgroups.conf.ProtocolStackConfigurator stack) static org.jgroups.conf.ProtocolStackConfiguratorParses a JGroups stack and resolves its variables.
-
Field Details
-
SINGLETON_NAME
The attribute of the transport protocol that makes the channels of a stack share one transport.- See Also:
-
PARTITION_NAME
The property naming the cluster partition, which qualifies the main channel's cluster name, so that two partitions on the same network never share a main channel.- See Also:
-
-
Method Details
-
parse
Parses a JGroups stack and resolves its variables.- Parameters:
xml- the JGroups configuration- Returns:
- the stack it declares
- Throws:
IllegalStateException- if the configuration cannot be parsed
-
getSingletonName
- Parameters:
stack- a JGroups stack- Returns:
- the singleton name of its transport, or
nullif its channels do not share it
-
createChannel
public static org.jgroups.JChannel createChannel(org.jgroups.conf.ProtocolStackConfigurator stack, String clusterName, String nodeName) throws Exception Creates a channel on the shared transport of a stack, opening the main channel of the stack if no other channel of this node uses it. The channel is not connected; closing it releases the main channel, which closes with the last of its forks.- Parameters:
stack- a JGroups stack whose transport has a singleton nameclusterName- the cluster the channel joins, which identifies its forknodeName- the name of the node, given to the main channel;nullto let JGroups generate one- Returns:
- the channel
- Throws:
InterruptedException- if the thread is interrupted while another one opens or closes a main channelException- if the main channel cannot be created or connected
-