|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.engine.TopicAccessor
public final class TopicAccessor
Singleton in ServerScope to access a TopicHandler instance.
Used to guarantee single threaded access to a TopicHandler instance. Only well defined methods allow dirty reads from other threads simultaneously, further we have a pattern to dispatch the topicHandler access to a worker thread.
TestTopicLifeCycle
Nested Class Summary | |
---|---|
private class |
TopicAccessor.Consumer
Called by msgUnitWrapper.toDestroyed(): this.glob.getTopicAccessor().entryDestroyed_scheduleForExecution(this); Is currently switched off (not used) |
private class |
TopicAccessor.TopicContainer
Helper class to hold the TopicHandler and some additonal locking information. |
Field Summary | |
---|---|
private java.util.concurrent.BlockingQueue |
blockingQueue
|
private static java.util.logging.Logger |
log
|
private ServerScope |
serverScope
|
private java.util.Map |
topicHandlerMap
Map for TopicContainer. |
private java.util.Set |
topicListenerSet
For listeners who want to be informed about topic creation / deletion events. |
Constructor Summary | |
---|---|
TopicAccessor(ServerScope serverScope)
|
Method Summary | |
---|---|
TopicHandler |
access(java.lang.String oid)
Access a topicHandler by its unique oid. |
TopicHandler |
accessDirtyRead(java.lang.String oid)
The topicHandler is not locked, use for read only access only and when you know what you are doing. |
private TopicAccessor.TopicContainer |
accessTopicContainer(java.lang.String oid)
|
void |
addTopicListener(I_TopicListener l)
Adds the specified Topic listener to receive creation/destruction events of Topics. |
void |
changeDirtyRead(MsgUnitWrapper msgUnitWrapper)
|
void |
entryDestroyed_scheduleForExecution(MsgUnitWrapper msgUnitWrapper)
Queue request for later execution, to be outside of sync-locks |
void |
erase(java.lang.String oid)
Remove the given topic |
TopicHandler |
findOrCreate(SessionInfo sessionInfo,
java.lang.String oid)
Access a topicHandler by its unique oid or create it if not known. |
private void |
fireTopicEvent(TopicHandler topicHandler)
Is fired on topic creation or destruction. |
int |
getNumTopics()
Access the number of known topics. |
I_TopicListener[] |
getRemotePropertiesListenerArr()
Access a current snapshot of all listeners. |
SubscriptionInfo[] |
getSubscriptionInfoArrDirtyRead(java.lang.String topicId)
|
private TopicHandler[] |
getTopicHandlerArr()
Treat as read only! For class internal use only. |
private TopicHandler |
getTopicHandlerDirtyRead(java.lang.String topicId)
|
java.lang.String[] |
getTopics()
Access oid array |
boolean |
hasMsgDistributorPluginDirtyRead(java.lang.String topicId)
|
MsgUnitWrapper |
lookupDirtyRead(java.lang.String topicId,
long msgUnitWrapperUniqueId)
Access the message meat without a lock. |
MsgUnitWrapper |
lookupNewest(java.lang.String topicId)
Access the newest entry. |
void |
release(TopicHandler topicHandler)
Return the topicHandler which you previously got with access(String oid). |
void |
removeTopicListener(I_TopicListener l)
Removes the specified listener. |
void |
spanTopicDestroyTimeout()
Called from SessionPersistencePlugin after all sessions / subscriptions are alive after a server startup. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump all TopicHandler to xml. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final ServerScope serverScope
private static java.util.logging.Logger log
private final java.util.Map topicHandlerMap
key = oid value from
private final java.util.Set topicListenerSet
private java.util.concurrent.BlockingQueue blockingQueue
Constructor Detail |
---|
public TopicAccessor(ServerScope serverScope)
Method Detail |
---|
public TopicHandler access(java.lang.String oid)
oid
- topicHandler.getUniqueKey()
public TopicHandler accessDirtyRead(java.lang.String oid)
oid
- topicHandler.getUniqueKey()
private TopicAccessor.TopicContainer accessTopicContainer(java.lang.String oid)
public void release(TopicHandler topicHandler)
topicHandler
- Currently logs severe if nullpublic TopicHandler findOrCreate(SessionInfo sessionInfo, java.lang.String oid) throws XmlBlasterException
sessionInfo
- Can be null if called by a subscriptionoid
- topicHandler.getUniqueKey()
XmlBlasterException
public void erase(java.lang.String oid) throws XmlBlasterException
topicHandler
-
XmlBlasterException
private TopicHandler[] getTopicHandlerArr()
public java.lang.String[] getTopics()
public int getNumTopics()
public void spanTopicDestroyTimeout()
public MsgUnitWrapper lookupDirtyRead(java.lang.String topicId, long msgUnitWrapperUniqueId) throws XmlBlasterException
topicId
- The topic oidmsgUnitWrapperUniqueId
- The message instance id
XmlBlasterException
public MsgUnitWrapper lookupNewest(java.lang.String topicId) throws XmlBlasterException
topicId
-
XmlBlasterException
public void changeDirtyRead(MsgUnitWrapper msgUnitWrapper) throws XmlBlasterException
XmlBlasterException
private TopicHandler getTopicHandlerDirtyRead(java.lang.String topicId)
public boolean hasMsgDistributorPluginDirtyRead(java.lang.String topicId)
public final SubscriptionInfo[] getSubscriptionInfoArrDirtyRead(java.lang.String topicId)
topicId
- key oid
public final java.lang.String toXml(java.lang.String extraOffset) throws XmlBlasterException
extraOffset
-
XmlBlasterException
public void entryDestroyed_scheduleForExecution(MsgUnitWrapper msgUnitWrapper)
msgUnitWrapper
- public void addTopicListener(I_TopicListener l)
Note that the fired event holds a locked topicHandler, you shouldn't spend too much time with it to allow other threads to do their work as well
l
- Your listener implementationpublic void removeTopicListener(I_TopicListener l)
l
- Your listener implementationpublic I_TopicListener[] getRemotePropertiesListenerArr()
private void fireTopicEvent(TopicHandler topicHandler)
Does never throw any exception
topicHandler
- The locked! handler
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |