Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

ClusterServer Class Reference

Inheritance diagram for ClusterServer:

AbstractServer IEventListener List of all members.

Public Member Functions

 this (InternetAddress bind, int threads, ILogger logger=null)
void enroll (ILogger logger)
void addCacheLoader (IPayload loader, bool enroll=false)
void start ()
void setCache (ClusterCache cache)
ClusterCache getCache ()
void setQueue (ClusterQueue queue)
char[] getProtocol ()
void notify (IEvent event, IPayload payload)
char[] toString ()
ServerSocket createSocket (InternetAddress bind, int backlog)
ServerThread createThread (ServerSocket socket)
void service (ServerThread st, IConduit conduit)

Private Member Functions

 this (InternetAddress bind, int threads, int backlog, ILogger logger=null)
char[] getRemoteAddress (IConduit conduit)
char[] getRemoteHost (IConduit conduit)
int getPort ()
char[] getHost ()
ILogger getLogger ()

Private Attributes

ClusterCache cache
ClusterQueue queue
Cluster cluster
IChannel channel
RollCall rollcall
CacheServer taskServer

Detailed Description

Extends the AbstractServer to glue cluster-server support together. Note that there may only be one server running for any given host name. This is to make it easier to manage the server(s) via one or more http clients. If you require more than one server per machine, virtual hosting will need to be provided.

Definition at line 74 of file ClusterServer.d.


Member Function Documentation

this InternetAddress  bind,
int  threads,
ILogger  logger = null
[inline]
 

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.

Definition at line 98 of file ClusterServer.d.

References channel, Cluster, cluster, Cluster::createChannel(), Cluster::createConsumer(), enroll(), AbstractServer::getLogger(), RollCall, rollcall, taskServer, and version.

void enroll ILogger  logger  )  [inline]
 

Definition at line 130 of file ClusterServer.d.

Referenced by addCacheLoader(), and this().

void addCacheLoader IPayload  loader,
bool  enroll = false
[inline]
 

Definition at line 138 of file ClusterServer.d.

References cluster, enroll(), IPickle::getGuid(), Cluster::getLogger(), and ILogger::info().

void start  )  [inline]
 

Start this server

Reimplemented from AbstractServer.

Definition at line 154 of file ClusterServer.d.

References Cluster::broadcast(), cache, channel, cluster, ClusterCache, queue, rollcall, AbstractServer::start(), taskServer, and version.

void setCache ClusterCache  cache  )  [inline]
 

Use this before starting the server

Definition at line 181 of file ClusterServer.d.

ClusterCache getCache  )  [inline]
 

Definition at line 190 of file ClusterServer.d.

References cache.

void setQueue ClusterQueue  queue  )  [inline]
 

Use this before starting the server

Definition at line 201 of file ClusterServer.d.

char [] getProtocol  )  [inline]
 

Return the protocol in use.

Reimplemented from IServer.

Definition at line 212 of file ClusterServer.d.

Referenced by toString().

void notify IEvent  event,
IPayload  payload
[inline]
 

Interface method that's invoked when a client is making discovery requests. We just send back our identity in a reply.

Reimplemented from IEventListener.

Definition at line 225 of file ClusterServer.d.

References Cluster::broadcast(), channel, cluster, RollCall::request, and rollcall.

char [] toString  )  [inline, virtual]
 

Return a text string identifying this server

Implements AbstractServer.

Definition at line 240 of file ClusterServer.d.

References getProtocol().

ServerSocket createSocket InternetAddress  bind,
int  backlog
[inline, virtual]
 

Create a ServerSocket instance.

Implements AbstractServer.

Definition at line 251 of file ClusterServer.d.

References ServerSocket.

ServerThread createThread ServerSocket  socket  )  [inline, virtual]
 

Create a ServerThread instance. This can be overridden to create other thread-types, perhaps with additional thread- level data attached.

Implements AbstractServer.

Definition at line 264 of file ClusterServer.d.

References ServerThread.

void service ServerThread  st,
IConduit  conduit
[inline]
 

Factory method for servicing a request. We just create a new ClusterThread to handle requests from the client. The thread does not exit until the socket connection is broken by the client, or some other exception occurs.

Reimplemented from AbstractServer.

Definition at line 278 of file ClusterServer.d.

References cache, cluster, ClusterThread, queue, and thread.

this InternetAddress  bind,
int  threads,
int  backlog,
ILogger  logger = null
[inline, inherited]
 

Setup this server with the requisite attributes. The number of threads specified dictate exactly that. You might have anything between 1 thread and several hundred, dependent upon the underlying O/S and hardware.

Parameter 'backlog' specifies the max number of"simultaneous" connection requests to be handled by an underlying socket implementation.

Definition at line 86 of file AbstractServer.d.

References assert(), AbstractServer::backlog, AbstractServer::bind, AbstractServer::logger, and AbstractServer::threads.

char [] getRemoteAddress IConduit  conduit  )  [inline, inherited]
 

Provide support for figuring out the remote address

Reimplemented from IServer.

Definition at line 139 of file AbstractServer.d.

References Socket::remoteAddress(), AbstractServer::socket, and InternetAddress::toAddrString().

char [] getRemoteHost IConduit  conduit  )  [inline, inherited]
 

Provide support for figuring out the remote host. Not currently implemented.

Reimplemented from IServer.

Definition at line 156 of file AbstractServer.d.

int getPort  )  [inline, inherited]
 

Return the local port we're attached to

Reimplemented from IServer.

Definition at line 167 of file AbstractServer.d.

References Socket::localAddress(), InternetAddress::port(), and AbstractServer::socket.

char [] getHost  )  [inline, inherited]
 

Return the local address we're attached to

Reimplemented from IServer.

Definition at line 179 of file AbstractServer.d.

References Socket::localAddress(), AbstractServer::socket, and InternetAddress::toAddrString().

ILogger getLogger  )  [inline, inherited]
 

Return the logger associated with this server

Definition at line 191 of file AbstractServer.d.

References AbstractServer::logger.

Referenced by ServerThread::run(), CacheServer::LoaderThread::this(), and this().


Member Data Documentation

ClusterCache cache [private]
 

Definition at line 76 of file ClusterServer.d.

Referenced by getCache(), service(), and start().

ClusterQueue queue [private]
 

Definition at line 77 of file ClusterServer.d.

Referenced by service(), and start().

Cluster cluster [private]
 

Definition at line 78 of file ClusterServer.d.

Referenced by addCacheLoader(), notify(), service(), start(), and this().

IChannel channel [private]
 

Definition at line 79 of file ClusterServer.d.

Referenced by notify(), start(), and this().

RollCall rollcall [private]
 

Definition at line 80 of file ClusterServer.d.

Referenced by notify(), start(), and this().

CacheServer taskServer [private]
 

Definition at line 81 of file ClusterServer.d.

Referenced by start(), and this().


The documentation for this class was generated from the following file:
Generated on Sat Dec 24 17:28:37 2005 for Mango by  doxygen 1.4.0