|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.cMsg.cMsgSubscription
public class cMsgSubscription
Class to store a client's subscription to a particular message subject and type. Used by both the cMsg domain API and cMsg subdomain handler objects. Once the domain server object is created, the only set method called is setNamespace. Thus, this object is for all intents and purposes immutable during its lifetime.
Constructor Summary | |
---|---|
cMsgSubscription(java.lang.String subject,
java.lang.String type,
int id,
cMsgCallbackThread cbThread)
Constructor used by cMsg domain API. |
|
cMsgSubscription(java.lang.String subject,
java.lang.String type,
java.lang.String namespace)
Constructor used by cMsg subdomain handler. |
Method Summary | |
---|---|
void |
addCallback(cMsgCallbackThread cbThread)
Method to add a callback thread. |
boolean |
addClientSubscriber(cMsgClientInfo client)
Adds a client to the set containing only regular clients subscribed to this subject, type, and namespace. |
void |
addNotifier(cMsgNotifier notifier)
Add a notifier object to the set of objects used to notify servers that their subscribeAndGet is complete. |
void |
addSubAndGetter(cMsgClientInfo client)
Adds a client to the hashmap containing all regular clients who have called cMsg.subscribeAndGet(java.lang.String, java.lang.String, int) . |
boolean |
addSubscriber(cMsgClientInfo client)
Adds a client to the set containing all clients (regular and bridge) subscribed to this subject, type, and namespace. |
boolean |
areWildCardsInSub()
Returns true if there are * or ? characters in subject. |
boolean |
areWildCardsInType()
Returns true if there are * or ? characters in type. |
void |
clearNotifiers()
Clear all notifier objects from the set of objects used to notify servers that their subscribeAndGet is complete. |
void |
clearSubAndGetters()
Clears the hashmap containing all regular clients who have called cMsg.subscribeAndGet(java.lang.String, java.lang.String, int) . |
boolean |
containsSubscriber(cMsgClientInfo client)
Is this a subscription of the given client (regular or bridge)? Used only on the server side. |
java.util.HashSet<cMsgClientInfo> |
getAllSubscribers()
Gets the set containing all clients (regular and bridge) subscribed to this subject, type, and namespace. |
java.util.HashSet<cMsgCallbackThread> |
getCallbacks()
Gets the hashset storing callback threads. |
java.util.HashSet<cMsgClientInfo> |
getClientSubscribers()
Gets the set containing only regular clients subscribed to this subject, type, and namespace. |
int |
getId()
Gets the id which client generates (receiverSubscribeId). |
java.lang.String |
getNamespace()
Gets the namespace in the cMsg subdomain in which this subscription resides. |
java.util.Set<cMsgNotifier> |
getNotifiers()
Gets the set of objects used to notify servers that their subscribeAndGet is complete. |
java.util.HashMap<cMsgClientInfo,java.lang.Integer> |
getSubAndGetters()
Gets the hashmap containing all regular clients who have called cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
with this subject, type, and namespace. |
java.lang.String |
getSubject()
Gets subject subscribed to. |
java.util.regex.Pattern |
getSubjectPattern()
Gets subject turned into compiled regular expression pattern. |
java.lang.String |
getSubjectRegexp()
Gets subject turned into regular expression that understands * and ?. |
java.lang.String |
getType()
Gets type subscribed to. |
java.util.regex.Pattern |
getTypePattern()
Gets type turned into compiled regular expression pattern. |
java.lang.String |
getTypeRegexp()
Gets type turned into regular expression that understands * and ?. |
int |
numberOfCallbacks()
Method to return the number of callback threads registered. |
int |
numberOfSubscribers()
Returns the total number of subscribers and subscribeAndGet callers subscribed to this subject, type, and namespace. |
void |
printSizes()
This method prints the sizes of all sets and maps. |
void |
removeCallback(cMsgCallbackThread cbThread)
Method to remove a callback thread. |
boolean |
removeClientSubscriber(cMsgClientInfo client)
Removes a client from the set containing only regular clients subscribed to this subject, type, and namespace. |
void |
removeNotifier(cMsgNotifier notifier)
Remove a notifier object from the set of objects used to notify servers that their subscribeAndGet is complete. |
void |
removeSubAndGetter(cMsgClientInfo client)
Removes a client from the hashmap containing all regular clients who have called cMsg.subscribeAndGet(java.lang.String, java.lang.String, int) . |
boolean |
removeSubscriber(cMsgClientInfo client)
Removes a client from the set containing all clients (regular and bridge) subscribed to this subject, type, and namespace. |
void |
setId(int id)
Sets the id which client generates (receiverSubscribeId). |
void |
setNamespace(java.lang.String namespace)
Sets the namespace in the cMsg subdomain in which this subscription resides. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public cMsgSubscription(java.lang.String subject, java.lang.String type, java.lang.String namespace)
subject
- subscription subjecttype
- subscription typenamespace
- namespace subscription exists inpublic cMsgSubscription(java.lang.String subject, java.lang.String type, int id, cMsgCallbackThread cbThread)
subject
- subscription subjecttype
- subscription typeid
- unique id referring to subject and type combinationcbThread
- object containing callback, its argument, and the thread to run itMethod Detail |
---|
public void printSizes()
public boolean areWildCardsInSub()
public boolean areWildCardsInType()
public java.lang.String getSubject()
public java.lang.String getSubjectRegexp()
public java.util.regex.Pattern getSubjectPattern()
public java.lang.String getType()
public java.lang.String getTypeRegexp()
public java.util.regex.Pattern getTypePattern()
public int getId()
public void setId(int id)
id
- id which client generates (receiverSubscribeId)public java.lang.String getNamespace()
public void setNamespace(java.lang.String namespace)
namespace
- namespace subscription resides inpublic java.util.HashSet<cMsgCallbackThread> getCallbacks()
public void addCallback(cMsgCallbackThread cbThread)
cbThread
- object containing callback thread, its argument,
and the thread to run itpublic void removeCallback(cMsgCallbackThread cbThread)
cbThread
- object containing callback thread to be removedpublic int numberOfCallbacks()
public java.util.HashSet<cMsgClientInfo> getClientSubscribers()
public boolean addClientSubscriber(cMsgClientInfo client)
client
- regular client to be added to subscription
public boolean removeClientSubscriber(cMsgClientInfo client)
client
- regular client to be removed from subscription
public java.util.HashSet<cMsgClientInfo> getAllSubscribers()
public boolean containsSubscriber(cMsgClientInfo client)
client
- client
public boolean addSubscriber(cMsgClientInfo client)
client
- client to be added to subscription
public boolean removeSubscriber(cMsgClientInfo client)
client
- client to be removed from subscription
public java.util.HashMap<cMsgClientInfo,java.lang.Integer> getSubAndGetters()
cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
with this subject, type, and namespace. A count is
keep of how many times subscribeAndGet for a particular
client has been called. The client info object is the key
and count is the value. This is used on the server side.
cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
public void addSubAndGetter(cMsgClientInfo client)
cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
.
This is used on the server side.
client
- client who called subscribeAndGetpublic void clearSubAndGetters()
cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
.
This is used on the server side.
public void removeSubAndGetter(cMsgClientInfo client)
cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
. If the client has
called subscribeAndGet more than once, it's entry in the table stays but
it's count of active subscribeAndGet calls is decremented.
This is used on the server side.
client
- client who called subscribeAndGetpublic int numberOfSubscribers()
public java.util.Set<cMsgNotifier> getNotifiers()
public void addNotifier(cMsgNotifier notifier)
notifier
- notifier objectpublic void removeNotifier(cMsgNotifier notifier)
notifier
- notifier objectpublic void clearNotifiers()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |