public class ClusteredServer extends DefaultServer
Serverimplementation for clustering.
With this implementation,
executed with every socket in every server in the cluster.
This implementation adopts the publish and subscribe model from Java Message Service to support clustering. Here, the exchanged message represents method invocation to be executed by every server in the cluster. The following methods create such messages.
onpublish(Action)and a message created by other servers is expected to be passed to
messageAction(). Therefore, what you need to do is to publish a message given through
onpublish(Action)to every server in the cluster and to subscribe a published message by other servers to delegate it to
Accordingly, such message must be able to be serialized and you have to pass
Serializable. However, serialization of
inner classes doesn't work in some cases as expected so that always use
Sentence instead of action if possible unless you use lambda
|Constructor and Description|
|Modifier and Type||Method and Description|
Executes the given action retrieving every socket in this server.
Executes the given action retrieving the socket tagged with the given tags in this server.
An action to receive a message published from one of nodes in the cluster.
Adds an action to be called with a message to be published to every node in the cluster.
all, byTag, byTag, on, onsocket, set_heartbeat, setHeartbeat
public Server all(io.cettia.platform.action.Action<ServerSocket> action)
public Server byTag(String names, io.cettia.platform.action.Action<ServerSocket> action)
Copyright 2015, The Cettia Project