Class Cluster
- java.lang.Object
-
- org.jgroups.ReceiverAdapter
-
- com.logicaldoc.enterprise.cluster.Cluster
-
- All Implemented Interfaces:
org.jgroups.blocks.RequestHandler
,org.jgroups.MembershipListener
,org.jgroups.MessageListener
,org.jgroups.Receiver
public class Cluster extends org.jgroups.ReceiverAdapter implements org.jgroups.blocks.RequestHandler
Object representation of a Cluster of LogicalDOC instances- Since:
- 6.5
- Author:
- Marco Meschieri - LogicalDOC
-
-
Constructor Summary
Constructors Constructor Description Cluster()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(String type, PayloadHandler handler)
Node
getLocalNode()
Return the current NodeNode
getNode(String id)
Gets a node by its identifierString
getNodeId()
The unique identifier of the local nodeList<Node>
getNodes()
Retrieves the list of nodes member of the clusterObject
handle(org.jgroups.Message msg)
boolean
isActive()
boolean
isCoordinator()
void
receive(org.jgroups.Message msg)
List<Object>
sendMessage(Payload payload)
Sends a message to all the cluster and waits for the response.void
setChannelFactory(ChannelFactory channelFactory)
void
setConfig(com.logicaldoc.util.config.ContextProperties config)
-
-
-
Method Detail
-
isActive
public boolean isActive()
-
getLocalNode
public Node getLocalNode()
Return the current Node- Returns:
- object representation of the node
-
getNode
public Node getNode(String id)
Gets a node by its identifier- Parameters:
id
- identifier of the node- Returns:
- object representation of the node
-
getNodes
public List<Node> getNodes()
Retrieves the list of nodes member of the cluster- Returns:
- list of all the nodes
-
sendMessage
public List<Object> sendMessage(Payload payload)
Sends a message to all the cluster and waits for the response.- Parameters:
payload
- The payload of the message to send- Returns:
- List of all the answers
-
getNodeId
public String getNodeId()
The unique identifier of the local node- Returns:
- identifier of the current node
-
setChannelFactory
public void setChannelFactory(ChannelFactory channelFactory)
-
isCoordinator
public boolean isCoordinator()
-
receive
public void receive(org.jgroups.Message msg)
- Specified by:
receive
in interfaceorg.jgroups.MessageListener
- Overrides:
receive
in classorg.jgroups.ReceiverAdapter
-
handle
public Object handle(org.jgroups.Message msg) throws Exception
- Specified by:
handle
in interfaceorg.jgroups.blocks.RequestHandler
- Throws:
Exception
-
setConfig
public void setConfig(com.logicaldoc.util.config.ContextProperties config)
-
addHandler
public void addHandler(String type, PayloadHandler handler)
-
-