Class SharedJGroupsTransport

java.lang.Object
org.exoplatform.services.ispn.SharedJGroupsTransport

public final class SharedJGroupsTransport extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    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.
    static final String
    The attribute of the transport protocol that makes the channels of a stack share one transport.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.jgroups.JChannel
    createChannel(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 String
    getSingletonName(org.jgroups.conf.ProtocolStackConfigurator stack)
     
    static org.jgroups.conf.ProtocolStackConfigurator
    Parses a JGroups stack and resolves its variables.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SINGLETON_NAME

      public static final String SINGLETON_NAME
      The attribute of the transport protocol that makes the channels of a stack share one transport.
      See Also:
    • PARTITION_NAME

      public static final String 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

      public static org.jgroups.conf.ProtocolStackConfigurator parse(String xml)
      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

      public static String getSingletonName(org.jgroups.conf.ProtocolStackConfigurator stack)
      Parameters:
      stack - a JGroups stack
      Returns:
      the singleton name of its transport, or null if 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 name
      clusterName - the cluster the channel joins, which identifies its fork
      nodeName - the name of the node, given to the main channel; null to let JGroups generate one
      Returns:
      the channel
      Throws:
      InterruptedException - if the thread is interrupted while another one opens or closes a main channel
      Exception - if the main channel cannot be created or connected