Class JGroupsCluster

    • Constructor Detail

      • JGroupsCluster

        public JGroupsCluster​(org.jgroups.JChannel channel,
                              JGroupsClusterConnection clusterConnection)
        Creates a new JGroups cluster implementation.
        Parameters:
        channel - Channel to use for the local node.
        clusterConnection - JGroups cluster connection to use.
    • Method Detail

      • start

        public void start()
                   throws Exception
        Starts the cluster when not started yet.
        Throws:
        Exception - When the cluster could not be started.
      • viewAccepted

        public void viewAccepted​(org.jgroups.View view)
        Specified by:
        viewAccepted in interface org.jgroups.Receiver
        Overrides:
        viewAccepted in class org.jgroups.blocks.ReplicatedHashMap<String,​NodeModel>
      • getID

        public String getID()
        Specified by:
        getID in interface ICluster
        Returns:
        The ID of the entire cluster.
      • getNodeList

        public List<NodeModel> getNodeList()
        Specified by:
        getNodeList in interface ICluster
        Returns:
        All nodes that are part of the cluster, whether or not they are currently connected.
      • getNodeIDs

        public String[] getNodeIDs()
        Specified by:
        getNodeIDs in interface ICluster
        Returns:
        A list of the IDs of all nodes that are part of the cluster, whether or not they are currently connected.
      • getLocaleNode

        public NodeModel getLocaleNode()
        Specified by:
        getLocaleNode in interface ICluster
        Returns:
        The local node, i.e. the node that corresponds to the server running this code.
      • disconnect

        public void disconnect()
        Disconnects the channel of this getLocaleNode().
      • sendMessage

        public void sendMessage​(IClusterMessage msg)
                         throws Exception
        Description copied from interface: ICluster
        Attempts to send a message to other nodes in the cluster.
        Specified by:
        sendMessage in interface ICluster
        Parameters:
        msg - Message to send to other nodes.
        Throws:
        Exception - When the message could not be sent, such as due to network failures.
      • changeLocaleNodeState

        public void changeLocaleNodeState​(ENodeState state)
        Description copied from interface: ICluster
        Changes the state of the local node, i.e. the node that corresponds to the server running this code.
        Specified by:
        changeLocaleNodeState in interface ICluster
        Parameters:
        state - The new state for the node.