|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.cMsg.cMsgSubdomainAdapter
org.jlab.coda.cMsg.subdomains.cMsg
public class cMsg
This class handles all client cMsg requests in the cMsg subdomain. Much of the functionality of this class is obtained by using static members. Practically, this means that only 1 name server can be run in a single JVM when using the cMsg subdomain.
Constructor Summary | |
---|---|
cMsg()
No-arg constructor. |
Method Summary | |
---|---|
java.lang.String[] |
getClientNames()
This method gets the names of all clients in the cMsg subdomain. |
java.lang.String[] |
getClientNamesAndNamespaces()
This method gets the names and namespaces of all clients in the cMsg subdomain. |
java.lang.String |
getNamespace()
Getter for namespace. |
void |
handleClientShutdown()
Method to handle a client or domain server shutdown. |
void |
handleKeepAlive()
Method to handle keepalive sent by domain client checking to see if the domain server socket is still up. |
void |
handleSendAndGetRequest(cMsgMessageFull message)
Method to synchronously get a single message from a responder to a message being sent by the client. |
void |
handleSendRequest(cMsgMessageFull message)
This method handles a message sent by reuglar (non-server) client. |
void |
handleServerSendAndGetRequest(cMsgMessageFull message,
java.lang.String namespace)
Method to synchronously get a single message from a resonder to a message beug sent by the server client. |
int |
handleServerSendAndGetRequest(cMsgMessageFull message,
java.lang.String namespace,
cMsgNotifier notifier)
Method to synchronously get a single message from a responder to a message being sent by the client. |
void |
handleServerSubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
cMsgNotifier notifier)
Method for regular client to synchronously get a single message from the server for a one-time subscription of a subject and type. |
void |
handleServerSubscribeRequest(java.lang.String subject,
java.lang.String type,
java.lang.String namespace)
Method to handle subscribe request sent by another cMsg server (server client). |
void |
handleServerUnsubscribeRequest(java.lang.String subject,
java.lang.String type,
java.lang.String namespace)
Method to handle unsubscribe request sent by another cMsg server (server client). |
void |
handleShutdownClientsRequest(java.lang.String client,
boolean includeMe)
Method to handle request to shutdown clients sent by client. |
void |
handleSubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
int id)
Method for regular client to synchronously get a single message from the server for a one-time subscription of a subject and type. |
void |
handleSubscribeRequest(java.lang.String subject,
java.lang.String type,
int id)
Method to handle subscribe request sent by regular client. |
int |
handleSyncSendRequest(cMsgMessageFull message)
Method to handle message sent by client in synchronous mode. |
void |
handleUnSendAndGetRequest(int id)
Method to handle remove sendAndGet request sent by any client (hidden from user). |
void |
handleUnsubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
int id)
Method to handle a remove subscribeAndGet request sent by client (hidden from user). |
void |
handleUnsubscribeRequest(java.lang.String subject,
java.lang.String type,
int id)
Method to handle unsubscribe request sent by regular client. |
boolean |
hasSend()
Method saying this subdomain implements handleSendRequest(org.jlab.coda.cMsg.cMsgMessageFull) . |
boolean |
hasSendAndGet()
Method saying this subdomain implements handleSendAndGetRequest(org.jlab.coda.cMsg.cMsgMessageFull) . |
boolean |
hasShutdown()
Method saying this subdomain implements handleShutdownClientsRequest(java.lang.String, boolean) . |
boolean |
hasSubscribe()
Method saying this subdomain implements handleSubscribeRequest(java.lang.String, java.lang.String, int) . |
boolean |
hasSubscribeAndGet()
Method saying this subdomain implements handleSubscribeAndGetRequest(java.lang.String, java.lang.String, int) . |
boolean |
hasSyncSend()
Method saying this subdomain implements handleSyncSendRequest(org.jlab.coda.cMsg.cMsgMessageFull) . |
boolean |
hasUnsubscribe()
Method saying this subdomain implements handleUnsubscribeRequest(java.lang.String, java.lang.String, int) . |
boolean |
isRegistered(java.lang.String name)
Method to see if domain client is registered. |
void |
localSend(cMsgMessage message,
java.lang.String namespace)
This method handles a message sent by a local bridge object's callback. |
void |
printSizes()
|
static void |
printStaticSizes()
|
void |
registerClient(cMsgClientInfo info)
Method to register a domain client. |
void |
registerServer(cMsgClientInfo info)
Method to register cMsg domain server as client. |
static boolean |
registrationLock(int delay)
This lock must be locked before a client registration in the cMsg subdomain can be made. |
static void |
registrationUnlock()
Unlock the registration lock. |
void |
setMessageDeliverer(cMsgDeliverMessageInterface deliverer)
Method to give the subdomain handler on object able to deliver messages to the client. |
void |
setUDLRemainder(java.lang.String UDLRemainder)
This method gives this subdomain handler the appropriate part of the UDL the client used to talk to the domain server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public cMsg()
Method Detail |
---|
public static void printStaticSizes()
public void printSizes()
public java.lang.String getNamespace()
public static boolean registrationLock(int delay)
delay
- time in milliseconds to wait for the lock before timing out
public static void registrationUnlock()
public java.lang.String[] getClientNames()
public java.lang.String[] getClientNamesAndNamespaces()
public boolean hasSend()
handleSendRequest(org.jlab.coda.cMsg.cMsgMessageFull)
.
hasSend
in interface cMsgSubdomainInterface
hasSend
in class cMsgSubdomainAdapter
public boolean hasSyncSend()
handleSyncSendRequest(org.jlab.coda.cMsg.cMsgMessageFull)
.
hasSyncSend
in interface cMsgSubdomainInterface
hasSyncSend
in class cMsgSubdomainAdapter
public boolean hasSubscribeAndGet()
handleSubscribeAndGetRequest(java.lang.String, java.lang.String, int)
.
hasSubscribeAndGet
in interface cMsgSubdomainInterface
hasSubscribeAndGet
in class cMsgSubdomainAdapter
public boolean hasSendAndGet()
handleSendAndGetRequest(org.jlab.coda.cMsg.cMsgMessageFull)
.
hasSendAndGet
in interface cMsgSubdomainInterface
hasSendAndGet
in class cMsgSubdomainAdapter
public boolean hasSubscribe()
handleSubscribeRequest(java.lang.String, java.lang.String, int)
.
hasSubscribe
in interface cMsgSubdomainInterface
hasSubscribe
in class cMsgSubdomainAdapter
public boolean hasUnsubscribe()
handleUnsubscribeRequest(java.lang.String, java.lang.String, int)
.
hasUnsubscribe
in interface cMsgSubdomainInterface
hasUnsubscribe
in class cMsgSubdomainAdapter
public boolean hasShutdown()
handleShutdownClientsRequest(java.lang.String, boolean)
.
hasShutdown
in interface cMsgSubdomainInterface
hasShutdown
in class cMsgSubdomainAdapter
public void setUDLRemainder(java.lang.String UDLRemainder) throws cMsgException
setUDLRemainder
in interface cMsgSubdomainInterface
setUDLRemainder
in class cMsgSubdomainAdapter
UDLRemainder
- last part of the UDL appropriate to the subdomain handler
cMsgException
- if there's an invalid namespacepublic void setMessageDeliverer(cMsgDeliverMessageInterface deliverer)
setMessageDeliverer
in interface cMsgSubdomainInterface
setMessageDeliverer
in class cMsgSubdomainAdapter
deliverer
- object able to deliver messages to the clientpublic boolean isRegistered(java.lang.String name)
name
- name of client
public void registerClient(cMsgClientInfo info) throws cMsgException
registerClient
in interface cMsgSubdomainInterface
registerClient
in class cMsgSubdomainAdapter
info
- information about client
cMsgException
- if client already exists or argument is nullpublic void registerServer(cMsgClientInfo info)
info
- information about clientpublic void localSend(cMsgMessage message, java.lang.String namespace) throws cMsgException
sendToSet
is not
thread-safe otherwise. Multiple threads in the domain server can be calling
this object's methods simultaneously.
message
- message from sendernamespace
- namespace of original message sender
cMsgException
- if a channel to the client is closed, cannot be created,
or socket properties cannot be setpublic void handleSendRequest(cMsgMessageFull message) throws cMsgException
handleSendRequest
in interface cMsgSubdomainInterface
handleSendRequest
in class cMsgSubdomainAdapter
message
- message from sender
cMsgException
- if a channel to the client is closed, cannot be created,
or socket properties cannot be setpublic int handleSyncSendRequest(cMsgMessageFull message) throws cMsgException
handleSyncSendRequest
in interface cMsgSubdomainInterface
handleSyncSendRequest
in class cMsgSubdomainAdapter
message
- message from sender
cMsgException
- if a channel to the client is closed, cannot be created,
or socket properties cannot be setpublic void handleSubscribeRequest(java.lang.String subject, java.lang.String type, int id) throws cMsgException
handleSubscribeRequest
in interface cMsgSubdomainInterface
handleSubscribeRequest
in class cMsgSubdomainAdapter
subject
- subject to subscribe totype
- type to subscribe toid
- id (not used)
cMsgException
- if a subscription for this subject and type already exists for this clientpublic void handleServerSubscribeRequest(java.lang.String subject, java.lang.String type, java.lang.String namespace) throws cMsgException
subject
- subject subscribed totype
- type subscribed tonamespace
- namespace subscription resides in
cMsgException
- if subscription already exists for this particular server clientpublic void handleUnsubscribeRequest(java.lang.String subject, java.lang.String type, int id)
handleUnsubscribeRequest
in interface cMsgSubdomainInterface
handleUnsubscribeRequest
in class cMsgSubdomainAdapter
subject
- subject of subscriptiontype
- type of subscriptionid
- id (not used)public void handleServerUnsubscribeRequest(java.lang.String subject, java.lang.String type, java.lang.String namespace)
subject
- subject of subscriptiontype
- type of subscriptionnamespace
- namespace subscription resides inpublic void handleSendAndGetRequest(cMsgMessageFull message) throws cMsgException
handleSendAndGetRequest
in interface cMsgSubdomainInterface
handleSendAndGetRequest
in class cMsgSubdomainAdapter
message
- message requesting what sort of message to get
cMsgException
- if a channel to the client is closed, cannot be created,
or socket properties cannot be setpublic int handleServerSendAndGetRequest(cMsgMessageFull message, java.lang.String namespace, cMsgNotifier notifier) throws cMsgException
message
- message requesting what sort of message to getnamespace
- namespace message resides innotifier
- object used to notify others that a response message has arrived
cMsgException
- if a channel to the client is closed, cannot be created,
or socket properties cannot be setpublic void handleServerSendAndGetRequest(cMsgMessageFull message, java.lang.String namespace) throws cMsgException
message
- message requesting what sort of message to getnamespace
- namespace message resides in
cMsgException
- if a channel to the client is closed, cannot be created,
or socket properties cannot be setpublic void handleUnSendAndGetRequest(int id)
handleUnSendAndGetRequest
in interface cMsgSubdomainInterface
handleUnSendAndGetRequest
in class cMsgSubdomainAdapter
id
- sendAndGet message's senderToken idpublic void handleSubscribeAndGetRequest(java.lang.String subject, java.lang.String type, int id)
handleSubscribeAndGetRequest
in interface cMsgSubdomainInterface
handleSubscribeAndGetRequest
in class cMsgSubdomainAdapter
subject
- subject subscribed totype
- type subscribed toid
- id (not used)public void handleServerSubscribeAndGetRequest(java.lang.String subject, java.lang.String type, cMsgNotifier notifier)
handleSubscribeAndGetRequest(java.lang.String, java.lang.String, int)
but instead calls this method after doing a subscribeAndGet through all the bridge
objects. The purpose of this is to install the notifier object.
subject
- subject subscribed totype
- type subscribed tonotifier
- object used to notify others that a matching message has arrivedpublic void handleUnsubscribeAndGetRequest(java.lang.String subject, java.lang.String type, int id)
handleUnsubscribeAndGetRequest
in interface cMsgSubdomainInterface
handleUnsubscribeAndGetRequest
in class cMsgSubdomainAdapter
subject
- subject of subscriptiontype
- type of subscriptionid
- request idpublic void handleShutdownClientsRequest(java.lang.String client, boolean includeMe) throws cMsgException
handleShutdownClientsRequest
in interface cMsgSubdomainInterface
handleShutdownClientsRequest
in class cMsgSubdomainAdapter
client
- client(s) to be shutdownincludeMe
- if true, this client may be shutdown too
cMsgException
- if a channel to the client is closed, cannot be created,
or socket properties cannot be setpublic void handleKeepAlive()
handleKeepAlive
in interface cMsgSubdomainInterface
handleKeepAlive
in class cMsgSubdomainAdapter
public void handleClientShutdown()
handleClientShutdown
in interface cMsgSubdomainInterface
handleClientShutdown
in class cMsgSubdomainAdapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |