|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.cMsg.cMsgDomainAdapter
org.jlab.coda.cMsg.cMsgDomain.client.cMsg
org.jlab.coda.cMsg.cMsgDomain.client.cMsgServerClient
public class cMsgServerClient
This class implements a cMsg client which is created in a cMsg server for the purpose of communicating with other cMsg servers in the cMsg domain.
Field Summary |
---|
Fields inherited from class org.jlab.coda.cMsg.cMsgDomain.client.cMsg |
---|
monitorXML, subscriptions |
Fields inherited from class org.jlab.coda.cMsg.cMsgDomainAdapter |
---|
connected, description, domain, host, name, receiving, shutdownHandler, UDL, UDLremainder |
Constructor Summary | |
---|---|
cMsgServerClient(cMsgNameServer nameServer)
Constructor. |
Method Summary | |
---|---|
void |
cleanup()
Method to clean up after this object. |
boolean |
cloudLock(int delay)
Lock the server (in cMsg subdomain) so that no other servers may simultaneously join the cMsg subdomain server cloud or register a client. |
void |
cloudUnlock()
Unlock the server enabling other servers to join the cMsg subdomain server cloud or register a client. |
java.util.HashSet<java.lang.String> |
connect(int fromNameServerPort,
boolean isOriginator,
java.lang.String cloudPassword)
Method to connect to the domain server from a cMsg server acting as a bridge. |
java.lang.String[] |
getClientNamesAndNamespaces()
This method gets the names and namespaces of all the local clients (not servers) of another cMsg domain server. |
void |
printSizes()
This method prints sizes of maps for debugging purposes. |
boolean |
registrationLock(int delay)
Grab the registration lock (for adding a client) of another cMsg domain server. |
void |
registrationUnlock()
Release the registration lock (when adding a client) of another cMsg domain server. |
int |
serverSendAndGet(cMsgMessage message,
java.lang.String namespace,
cMsgCallbackInterface cb)
The message is sent by a server client to another server as it would be in the cMsg.send(org.jlab.coda.cMsg.cMsgMessage) method. |
void |
serverShutdown()
Method to shutdown the server connected to. |
void |
serverShutdownClients(java.lang.String client,
boolean includeMe)
Method to shutdown the given clients. |
void |
serverSubscribe(java.lang.String subject,
java.lang.String type,
java.lang.String namespace,
cMsgCallbackInterface cb,
java.lang.Object userObj)
Method for a server to subscribe to receive messages of a subject and type from another domain server. |
void |
serverUnSendAndGet(int id)
Method to remove a previous serverSendAndGet. |
void |
serverUnsubscribe(java.lang.String subject,
java.lang.String type,
java.lang.String namespace,
cMsgCallbackInterface cb,
java.lang.Object userObj)
Method for a server to unsubscribe a previous subscription to receive messages of a subject and type from another domain server. |
void |
thisServerCloudStatus(int status)
This method tells the server this server is connected to, what cloud status this server has. |
Methods inherited from class org.jlab.coda.cMsg.cMsgDomain.client.cMsg |
---|
connect, disconnect, flush, monitor, send, sendAndGet, shutdownClients, shutdownServers, subscribe, subscribeAndGet, syncSend, unsubscribe |
Methods inherited from class org.jlab.coda.cMsg.cMsgDomainAdapter |
---|
getDescription, getDomain, getHost, getName, getShutdownHandler, getString, getUDL, getUDLRemainder, isConnected, isReceiving, setDescription, setName, setShutdownHandler, setUDL, setUDLRemainder, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public cMsgServerClient(cMsgNameServer nameServer) throws cMsgException
nameServer
- nameServer this client is running in
cMsgException
- if local host name cannot be foundMethod Detail |
---|
public void printSizes()
public void cleanup()
public java.util.HashSet<java.lang.String> connect(int fromNameServerPort, boolean isOriginator, java.lang.String cloudPassword) throws cMsgException
cMsgServerBridge
.
Unfortunately, this is a method largely duplicated from the base class but
with a few small changes.
fromNameServerPort
- port of name server calling this methodisOriginator
- true if originating the connection between the 2 servers and
false if this is the response or reciprocal connectioncloudPassword
- password for connecting to a server in a particular cloud
cMsgException
- if there are problems parsing the UDL or
communication problems with the serverpublic int serverSendAndGet(cMsgMessage message, java.lang.String namespace, cMsgCallbackInterface cb) throws java.io.IOException
cMsg.send(org.jlab.coda.cMsg.cMsgMessage)
method. The receiving server notes
the fact that a response to it is expected, and sends it to all subscribed to its
subject and type. When a marked response is received from a client, it sends that
first response back to the original sender regardless of its subject or type.
message
- message sent to servernamespace
- namespace of message sentcb
- callback to run on receipt of response message
java.io.IOException
- if there are communication problems with the serverpublic void serverUnSendAndGet(int id) throws java.io.IOException
id
- unique id of serverSendAndGet request to delete
java.io.IOException
- if there are communication problems with the serverpublic void serverSubscribe(java.lang.String subject, java.lang.String type, java.lang.String namespace, cMsgCallbackInterface cb, java.lang.Object userObj) throws java.io.IOException
subject
- message subjecttype
- message typenamespace
- message namespacecb
- callback object whose single method is called upon receiving a message
of subject and typeuserObj
- any user-supplied object to be given to the callback method as an argument
java.io.IOException
- there are communication problems with the serverpublic void serverUnsubscribe(java.lang.String subject, java.lang.String type, java.lang.String namespace, cMsgCallbackInterface cb, java.lang.Object userObj) throws java.io.IOException
subject
- message subjecttype
- message typenamespace
- message namespacecb
- callback object whose single method is called upon receiving a message
of subject and typeuserObj
- any user-supplied object to be given to the callback method as an argument
java.io.IOException
- there are communication problems with the serverpublic void serverShutdownClients(java.lang.String client, boolean includeMe) throws java.io.IOException
client
- client(s) to be shutdownincludeMe
- if true, it is permissible to shutdown calling client
java.io.IOException
- if there are communication problems with the serverpublic void serverShutdown() throws java.io.IOException
java.io.IOException
- if there are communication problems with the serverpublic boolean cloudLock(int delay) throws java.io.IOException
delay
- time in milliseconds to wait for locked to be grabbed before timing out
java.io.IOException
- if there are communication problems with the name serverpublic void cloudUnlock() throws java.io.IOException
java.io.IOException
- if there are communication problems with the name serverpublic boolean registrationLock(int delay) throws java.io.IOException
delay
- time in milliseconds to wait for the lock before timing out
java.io.IOException
- if there are communication problems with the name serverpublic void registrationUnlock() throws java.io.IOException
java.io.IOException
- if communication error with serverpublic void thisServerCloudStatus(int status) throws java.io.IOException
status
- cMsgNameServer.INCLOUD, .NONCLOUD, or .BECOMINGCLOUD
java.io.IOException
- if communication error with serverpublic java.lang.String[] getClientNamesAndNamespaces() throws java.io.IOException
java.io.IOException
- if communication error with server
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |