public class cMsg extends cMsgSubdomainAdapter
| Constructor and Description |
|---|
cMsg()
No-arg constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String[] |
getClientNames()
This method gets the names of all clients in the cMsg subdomain.
|
static 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 |
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 regular (non-server) client.
|
void |
handleServerSendAndGetRequest(cMsgMessageFull message,
java.lang.String namespace)
Method to synchronously get a single message from a responder to a message
being 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.common.cMsgMessageFull). |
boolean |
hasSendAndGet()
Method saying this subdomain implements
handleSendAndGetRequest(org.jlab.coda.cMsg.common.cMsgMessageFull). |
boolean |
hasShutdown()
Method saying this subdomain implements
handleShutdownClientsRequest(String, boolean). |
boolean |
hasSubscribe()
Method saying this subdomain implements
handleSubscribeRequest(String, String, int). |
boolean |
hasSubscribeAndGet()
Method saying this subdomain implements
handleSubscribeAndGetRequest(String, String, int). |
boolean |
hasSyncSend()
Method saying this subdomain implements
handleSyncSendRequest(org.jlab.coda.cMsg.common.cMsgMessageFull). |
boolean |
hasUnsubscribe()
Method saying this subdomain implements
handleUnsubscribeRequest(String, String, int). |
static 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.
|
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 outpublic static void registrationUnlock()
public static java.lang.String[] getClientNames()
public static java.lang.String[] getClientNamesAndNamespaces()
public boolean hasSend()
handleSendRequest(org.jlab.coda.cMsg.common.cMsgMessageFull).hasSend in interface cMsgSubdomainInterfacehasSend in class cMsgSubdomainAdapterpublic boolean hasSyncSend()
handleSyncSendRequest(org.jlab.coda.cMsg.common.cMsgMessageFull).hasSyncSend in interface cMsgSubdomainInterfacehasSyncSend in class cMsgSubdomainAdapterpublic boolean hasSubscribeAndGet()
handleSubscribeAndGetRequest(String, String, int).hasSubscribeAndGet in interface cMsgSubdomainInterfacehasSubscribeAndGet in class cMsgSubdomainAdapterpublic boolean hasSendAndGet()
handleSendAndGetRequest(org.jlab.coda.cMsg.common.cMsgMessageFull).hasSendAndGet in interface cMsgSubdomainInterfacehasSendAndGet in class cMsgSubdomainAdapterpublic boolean hasSubscribe()
handleSubscribeRequest(String, String, int).hasSubscribe in interface cMsgSubdomainInterfacehasSubscribe in class cMsgSubdomainAdapterpublic boolean hasUnsubscribe()
handleUnsubscribeRequest(String, String, int).hasUnsubscribe in interface cMsgSubdomainInterfacehasUnsubscribe in class cMsgSubdomainAdapterpublic boolean hasShutdown()
handleShutdownClientsRequest(String, boolean).hasShutdown in interface cMsgSubdomainInterfacehasShutdown in class cMsgSubdomainAdapterpublic void setUDLRemainder(java.lang.String UDLRemainder)
throws cMsgException
setUDLRemainder in interface cMsgSubdomainInterfacesetUDLRemainder in class cMsgSubdomainAdapterUDLRemainder - last part of the UDL appropriate to the subdomain handlercMsgException - if there's an invalid namespacepublic void setMessageDeliverer(cMsgDeliverMessageInterface deliverer)
deliverer - object able to deliver messages to the clientpublic static boolean isRegistered(java.lang.String name)
name - name of clientpublic void registerClient(cMsgClientInfo info) throws cMsgException
registerClient in interface cMsgSubdomainInterfaceregisterClient in class cMsgSubdomainAdapterinfo - information about clientcMsgException - 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 sendercMsgException - if a channel to the client is closed, cannot be created,
socket properties cannot be set, or subdomain handler is shutdownpublic void handleSendRequest(cMsgMessageFull message) throws cMsgException
handleSendRequest in interface cMsgSubdomainInterfacehandleSendRequest in class cMsgSubdomainAdaptermessage - message from sendercMsgException - if a channel to the client is closed, cannot be created,
socket properties cannot be set, or subdomain handler is shutdownpublic int handleSyncSendRequest(cMsgMessageFull message) throws cMsgException
handleSyncSendRequest in interface cMsgSubdomainInterfacehandleSyncSendRequest in class cMsgSubdomainAdaptermessage - message from sendercMsgException - if a channel to the client is closed, cannot be created,
socket properties cannot be set, or subdomain handler is shutdownpublic void handleSubscribeRequest(java.lang.String subject,
java.lang.String type,
int id)
throws cMsgException
handleSubscribeRequest in interface cMsgSubdomainInterfacehandleSubscribeRequest in class cMsgSubdomainAdaptersubject - subject to subscribe totype - type to subscribe toid - id (not used)cMsgException - if a subscription for this subject and type already exists for this client,
or subdomain handler is shutdownpublic 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 incMsgException - if a subscription for this subject and type already exists for this client,
or subdomain handler is shutdownpublic void handleUnsubscribeRequest(java.lang.String subject,
java.lang.String type,
int id)
throws cMsgException
handleUnsubscribeRequest in interface cMsgSubdomainInterfacehandleUnsubscribeRequest in class cMsgSubdomainAdaptersubject - subject of subscriptiontype - type of subscriptionid - id (not used)cMsgException - if subdomain handler is shutdownpublic void handleServerUnsubscribeRequest(java.lang.String subject,
java.lang.String type,
java.lang.String namespace)
throws cMsgException
subject - subject of subscriptiontype - type of subscriptionnamespace - namespace subscription resides incMsgException - if subdomain handler is shutdownpublic void handleSendAndGetRequest(cMsgMessageFull message) throws cMsgException
handleSendAndGetRequest in interface cMsgSubdomainInterfacehandleSendAndGetRequest in class cMsgSubdomainAdaptermessage - message requesting what sort of message to getcMsgException - if a channel to the client is closed, cannot be created,
socket properties cannot be set, or if subdomain handler is shutdownpublic 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 arrivedcMsgException - if a channel to the client is closed, cannot be created,
socket properties cannot be set, or if subdomain handler is shutdownpublic void handleServerSendAndGetRequest(cMsgMessageFull message, java.lang.String namespace) throws cMsgException
message - message requesting what sort of message to getnamespace - namespace message resides incMsgException - if a channel to the client is closed, cannot be created,
socket properties cannot be set, or if subdomain handler is shutdownpublic void handleUnSendAndGetRequest(int id)
throws cMsgException
handleUnSendAndGetRequest in interface cMsgSubdomainInterfacehandleUnSendAndGetRequest in class cMsgSubdomainAdapterid - sendAndGet message's senderToken idcMsgException - if subdomain handler is shutdownpublic void handleSubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
int id)
throws cMsgException
handleSubscribeAndGetRequest in interface cMsgSubdomainInterfacehandleSubscribeAndGetRequest in class cMsgSubdomainAdaptersubject - subject subscribed totype - type subscribed toid - id (not used)cMsgException - if subdomain handler is shutdownpublic void handleServerSubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
cMsgNotifier notifier)
throws cMsgException
handleSubscribeAndGetRequest(String, 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 arrivedcMsgException - if subdomain handler is shutdownpublic void handleUnsubscribeAndGetRequest(java.lang.String subject,
java.lang.String type,
int id)
throws cMsgException
handleUnsubscribeAndGetRequest in interface cMsgSubdomainInterfacehandleUnsubscribeAndGetRequest in class cMsgSubdomainAdaptersubject - subject of subscriptiontype - type of subscriptionid - request idcMsgException - if subdomain handler is shutdownpublic void handleShutdownClientsRequest(java.lang.String client,
boolean includeMe)
throws cMsgException
handleShutdownClientsRequest in interface cMsgSubdomainInterfacehandleShutdownClientsRequest in class cMsgSubdomainAdapterclient - client(s) to be shutdownincludeMe - if true, this client may be shutdown toocMsgException - if a channel to the client is closed, cannot be created,
socket properties cannot be set, or if subdomain handler is shutdownpublic void handleClientShutdown()
AFTER THIS METHOD IS RUN, NO OTHER METHODS IN THIS OBJECT SHOULD BE RUN!!!
handleClientShutdown in interface cMsgSubdomainInterfacehandleClientShutdown in class cMsgSubdomainAdapter