tango.net.cluster.tina.ClusterServer

License:

BSD style: see license.txt

Version:

July 2004: Initial release

Author:

Kris
class ClusterServer : AbstractServer [abstract] #
Extends the AbstractServer to glue cluster support together.
void service(SocketConduit conduit) [abstract] #
Concrete server must expose a service handler
this(char[] name, InternetAddress bind, Logger logger) #
Construct this server with the requisite attributes. The 'bind' address is the local address we'll be listening on, 'threads' represents the number of socket-accept threads, and backlog is the number of "simultaneous" connection requests that a socket layer will buffer on our behalf.
We also set up a listener for client discovery-requests, and lastly, we tell active clients that we're available for work. Clients should be listening on the appropriate channel for an instance of the RollCall payload.
void enroll(IMessage task) #
void start(RollCall id, bool reuse = false) #
Start the server
Note that we hijack the calling thread, and use it to generate a hearbeat. The hearbeat has two functions: it tells all clients when this server starts, and it tells them we're still alive. The latter is important if, for example, a client request to this server had timed-out due to the server being too busy. In such a case, the client will mark the server as being unavailable, and the heartbeat will presumably revert that.

It would also be useful to monitor the GC from here.

char[] getProtocol() #
Return a text string identifying this server
char[] toString() [override] #
Return a text string identifying this server
ServerSocket createSocket(InternetAddress bind, int backlog, bool reuse = false) [override] #
Create a ServerSocket instance.
void createThread(ServerSocket socket) [override] #
Create a ServerThread instance. This can be overridden to create other thread-types, perhaps with additional thread- level data attached.
void notify(IEvent event) [private] #
Interface method that's invoked when a client is making discovery requests. We just send back our identity in a reply