|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.NotificationBroadcasterSupport org.xmlBlaster.authentication.SubjectInfo
public final class SubjectInfo
The SubjectInfo stores all known data about a client.
It also contains a subject queue, where messages are stored until they are delivered at the next login of this client.
There are three states for SubjectInfo namely UNDEF, ALIVE, DEAD. A transition from UNDEF directly to DEAD is not supported. Transitions from ALIVE or DEAD to UNDEF are not possible.
Field Summary | |
---|---|
int |
ALIVE
State after calling toAlive() |
private Authenticate |
authenticate
|
private boolean |
blockClientLogin
|
CallbackAddress[] |
callbackAddressCache
|
private ContextNode |
contextNode
|
int |
DEAD
State after calling shutdown() |
private boolean |
determineNodeId
|
private DispatchStatistic |
dispatchStatistic
|
private ServerScope |
glob
|
private static long |
instanceCounter
Statistics |
private long |
instanceId
|
private java.util.concurrent.locks.ReentrantLock |
lock
|
private static java.util.logging.Logger |
log
|
private int |
maxSessions
|
private JmxMBeanHandle |
mbeanHandle
My JMX registration |
private java.lang.String |
ME
|
private MsgErrorHandler |
msgErrorHandler
|
private NodeId |
nodeId
|
private QueueQueryPlugin |
queueQueryPlugin
this is used for administrative gets (queries on callback queue) |
private I_Subject |
securityCtx
The partner class from the security framework |
private SessionInfo[] |
sessionArrCache
|
private java.util.Map<java.lang.String,SessionInfo> |
sessionMap
All sessions of this subject are stored in this map. |
private long |
startupTime
Incarnation time of this object instance in millis |
private int |
state
|
private SubjectInfoProtector |
subjectInfoProtector
|
private SessionName |
subjectName
The cluster wide unique identifier of the subject e.g. |
private I_Queue |
subjectQueue
All MsgUnit which can't be delivered to the client (if he is not logged in) are queued here and are delivered when the client comes on line. |
int |
UNDEF
State during and after construction |
Constructor Summary | |
---|---|
SubjectInfo(ServerScope glob,
Authenticate authenticate,
SessionName subjectName)
|
Method Summary | |
---|---|
java.lang.String |
blockClientAndResetConnections()
|
void |
checkNumberOfSessions(ConnectQosServer qos)
|
private I_Queue |
createSubjectQueue(CbQueueProperty prop)
|
void |
finalize()
Shutdown my queue |
SessionInfo |
findSessionInfo(AddressBase addr)
If you have a callback address and want to know to which session it belongs. |
long |
forwardToSessionQueue()
Forward entries in subject queue to all session queues, if no entries are available we return 0 without doing anything. |
private int |
forwardToSessionQueue(MsgQueueEntry entry)
Forward the given message to session queue. |
CallbackAddress[] |
getCallbackAddresses()
Get the callback addresses for this subjectQueue, every session callback may have decided to receive subject messages |
ContextNode |
getContextNode()
The unique name of this subject instance. |
int |
getCountSessionsInternal()
|
int |
getCountSessionsUser()
|
java.lang.String |
getCreationDate()
|
SessionInfo |
getFirstSession()
|
java.lang.String |
getId()
Cluster wide unique identifier "/node/heron/client/ |
java.util.concurrent.locks.ReentrantLock |
getLock()
Access the synchronization object of this SubjectInfo instance. |
java.lang.String |
getLoginName()
Access the unique login name of a client. |
(package private) int |
getMaxSessions()
|
I_MsgErrorHandler |
getMsgErrorHandler()
|
NodeId |
getNodeId()
|
javax.management.MBeanNotificationInfo[] |
getNotificationInfo()
JMX: Enforced by interface NotificationBroadcasterSupport |
int |
getNumAliveSessions()
|
(package private) int |
getNumSessions()
Access the number of sessions of this user. |
(package private) long |
getNumUpdate()
How many update where sent for this client, the sum of all session and subject queues of this clients. |
(package private) SessionInfo |
getOrCreateSessionInfo(SessionName sessionName,
ConnectQosServer connectQos)
Blocks for existing SessionInfo until it is initialized. |
I_Subject |
getSecurityCtx()
Subject specific informations from the security framework |
SessionInfo |
getSession(SessionName sessionName)
Find a session by its public session ID. |
SessionInfo |
getSessionByAbsoluteName(java.lang.String absoluteName)
Find a session by its absolute name. |
SessionInfo |
getSessionByPublicId(long publicSessionId)
Get the SessionInfo with its public session identifier e.g. |
(package private) I_AdminSession |
getSessionByPubSessionId(long pubSessionId)
Find a session by its public session ID. |
SessionInfo |
getSessionInfo(SessionName sessionName)
Find a session by its pubSessionId or return null if not found |
(package private) java.lang.String |
getSessionList()
Access a list of public session identifier e.g. |
SessionInfo[] |
getSessions()
Access the collection containing all SessionInfo objects of this user. |
SessionInfo[] |
getSessionsToClear(ConnectQosServer q)
Check if client does a re-login and wants to destroy old sessions. |
java.lang.String |
getStateStr()
|
(package private) SubjectInfoProtector |
getSubjectInfoProtector()
|
SessionName |
getSubjectName()
Access the unique login name of a client. |
I_Queue |
getSubjectQueue()
This queue holds all messages which where addressed to destination loginName |
MsgUnit[] |
getSubjectQueueEntries(java.lang.String querySpec)
Query the subject queue, can be peeking or consuming. |
(package private) long |
getSubjectQueueMaxMsgs()
|
(package private) long |
getSubjectQueueNumMsgs()
|
(package private) long |
getUptime()
|
java.lang.String |
getUsageUrl()
JMX |
boolean |
isAlive()
|
boolean |
isBlockClientLogin()
|
boolean |
isCluster()
|
boolean |
isDead()
|
boolean |
isLoggedIn()
Is the client currently logged in? |
boolean |
isUndef()
|
(package private) java.lang.String |
killClient()
Kills all sessions of this client |
void |
notifyAboutLogin(SessionInfo sessionInfo)
Get notification that the client did a login. |
void |
notifyAboutLogout(java.lang.String absoluteSessionName,
boolean clearQueue,
boolean forceShutdownEvenIfEntriesExist)
Get notification that the client did a logout. |
java.lang.String[] |
peekSubjectMessages(int numOfEntries)
|
java.lang.String[] |
peekSubjectMessagesToFile(int numOfEntries,
java.lang.String path)
|
void |
queueMessage(MsgQueueEntry entry)
PtP mode: If the qos is set to forceQueuing the message is queued. |
java.lang.String |
setBlockClientLogin(boolean blockClient)
|
(package private) void |
setMaxSessions(int max)
JMX access. |
void |
setSecurityCtx(I_Subject securityCtx)
|
void |
setSubjectQueueProperty(CbQueueProperty prop)
Allows to overwrite queue property. |
void |
setUsageUrl(java.lang.String url)
|
void |
shutdown(boolean clearQueue,
boolean forceIfEntries)
The shutdown is synchronized and checks if there is no need for this subject anymore. |
void |
toAlive(I_Subject securityCtx,
CbQueueProperty prop)
Initialize SubjectInfo |
java.lang.String |
toString()
|
java.lang.String |
toXml()
Dump state of this object into a XML ASCII string. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string. |
java.lang.String |
usage()
JMX |
void |
waitUntilAlive(boolean returnLocked)
if state==UNDEF we block until we are ALIVE (or DEAD) |
Methods inherited from class javax.management.NotificationBroadcasterSupport |
---|
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String ME
private final ServerScope glob
private static java.util.logging.Logger log
private final ContextNode contextNode
private final Authenticate authenticate
private SessionName subjectName
private I_Subject securityCtx
private boolean blockClientLogin
private java.util.Map<java.lang.String,SessionInfo> sessionMap
private volatile SessionInfo[] sessionArrCache
public CallbackAddress[] callbackAddressCache
private MsgErrorHandler msgErrorHandler
private final DispatchStatistic dispatchStatistic
private final SubjectInfoProtector subjectInfoProtector
private NodeId nodeId
private boolean determineNodeId
private long startupTime
private int maxSessions
public final int UNDEF
public final int ALIVE
public final int DEAD
private int state
private java.util.concurrent.locks.ReentrantLock lock
private I_Queue subjectQueue
Node objects = MsgQueueEntry
private volatile QueueQueryPlugin queueQueryPlugin
private static long instanceCounter
private long instanceId
private JmxMBeanHandle mbeanHandle
Constructor Detail |
---|
public SubjectInfo(ServerScope glob, Authenticate authenticate, SessionName subjectName) throws XmlBlasterException
subjectName
- The unique loginNamesecurityCtx
- The security context of this subjectprop
- The property from the subject queue, usually from connectQos.getSubjectQueueProperty()
XmlBlasterException
Method Detail |
---|
public final ContextNode getContextNode()
public void waitUntilAlive(boolean returnLocked) throws XmlBlasterException
If
- we are DEAD or on one minute timeout, subjectInfo is never locked in such a case
XmlBlasterException
public java.util.concurrent.locks.ReentrantLock getLock()
SubjectInfoProtector getSubjectInfoProtector()
public void toAlive(I_Subject securityCtx, CbQueueProperty prop) throws XmlBlasterException
securityCtx
- Can be null for PtP message with implicit SubjectInfo creationprop
- The property to configure the PtP message queue
XmlBlasterException
private I_Queue createSubjectQueue(CbQueueProperty prop) throws XmlBlasterException
XmlBlasterException
public void shutdown(boolean clearQueue, boolean forceIfEntries)
clearQueue==false&&forceIfEntries==true: We shutdown and preserve existing PtP messages
clearQueue
- Shall the message queue of the client be destroyed as well on last session logout?forceIfEntries
- Shutdown even if there are messages in the queuepublic void finalize()
finalize
in class java.lang.Object
SessionInfo getOrCreateSessionInfo(SessionName sessionName, ConnectQosServer connectQos) throws XmlBlasterException
sessionName
- connectQos
-
XmlBlasterException
public SessionInfo getSessionInfo(SessionName sessionName)
public final NodeId getNodeId() throws XmlBlasterException
XmlBlasterException
public boolean isCluster() throws XmlBlasterException
XmlBlasterException
public final void setSubjectQueueProperty(CbQueueProperty prop) throws XmlBlasterException
It will be only written if prop!= null.
prop
- CbQueueProperty transports subject queue property as well
TODO: we should have a clear named SubjectQueueProperty
XmlBlasterException
public I_Queue getSubjectQueue()
public I_Subject getSecurityCtx()
public void setSecurityCtx(I_Subject securityCtx)
public final void queueMessage(MsgQueueEntry entry) throws XmlBlasterException
msgUnit
- The message. Only called in sync mode on publish (TopicHandler)destination
- The Destination object of the receiver
XmlBlasterException
public final long forwardToSessionQueue()
private final int forwardToSessionQueue(MsgQueueEntry entry) throws XmlBlasterException
XmlBlasterException
- if not delivered at all.public final I_MsgErrorHandler getMsgErrorHandler()
public final boolean isLoggedIn()
public final SessionInfo[] getSessions()
public final int getCountSessionsInternal()
public final int getCountSessionsUser()
public final SessionInfo getSessionByAbsoluteName(java.lang.String absoluteName)
absoluteName
- e.g. "/node/heron/client/joe/2"
public final SessionInfo getSession(SessionName sessionName)
sessionName
-
public final SessionInfo getFirstSession()
public final CallbackAddress[] getCallbackAddresses()
public final SessionInfo findSessionInfo(AddressBase addr)
addr
- The address object
public final void checkNumberOfSessions(ConnectQosServer qos) throws XmlBlasterException
Throws
- XmlBlasterException if max. sessions is exhausted
XmlBlasterException
public SessionInfo[] getSessionsToClear(ConnectQosServer q)
public final void notifyAboutLogin(SessionInfo sessionInfo) throws XmlBlasterException
XmlBlasterException
public final void notifyAboutLogout(java.lang.String absoluteSessionName, boolean clearQueue, boolean forceShutdownEvenIfEntriesExist) throws XmlBlasterException
absoluteSessionName
- == sessionInfo.getId()clearQueue
- Shall the message queue of the client be cleared&destroyed as well (e.g. disconnectQos.deleteSubjectQueue())?forceShutdownEvenIfEntriesExist
- on last session
XmlBlasterException
public final SessionName getSubjectName()
public final java.lang.String getId()
public final java.lang.String toString()
toString
in class java.lang.Object
getId()
public final java.lang.String getLoginName()
public final java.lang.String toXml()
public final java.lang.String toXml(java.lang.String extraOffset)
extraOffset
- indenting of tags for nice output
public final SessionInfo getSessionByPublicId(long publicSessionId)
public final boolean isUndef()
public final boolean isAlive()
public final boolean isDead()
public final java.lang.String getStateStr()
public MsgUnit[] getSubjectQueueEntries(java.lang.String querySpec) throws XmlBlasterException
querySpec
- Can be configured to be consuming
XmlBlasterException
long getUptime()
public final java.lang.String getCreationDate()
long getNumUpdate()
long getSubjectQueueNumMsgs()
long getSubjectQueueMaxMsgs()
public boolean isBlockClientLogin()
public java.lang.String setBlockClientLogin(boolean blockClient)
public java.lang.String blockClientAndResetConnections()
int getNumSessions()
public int getNumAliveSessions()
int getMaxSessions()
void setMaxSessions(int max)
Change
- the max allowed simultaneous logins of this userjava.lang.String getSessionList()
I_AdminSession getSessionByPubSessionId(long pubSessionId)
pubSessionId
- e.g. "-2"
java.lang.String killClient() throws XmlBlasterException
XmlBlasterException
public java.lang.String[] peekSubjectMessages(int numOfEntries) throws XmlBlasterException
XmlBlasterException
public java.lang.String[] peekSubjectMessagesToFile(int numOfEntries, java.lang.String path) throws java.lang.Exception
java.lang.Exception
public java.lang.String usage()
public java.lang.String getUsageUrl()
public void setUsageUrl(java.lang.String url)
public javax.management.MBeanNotificationInfo[] getNotificationInfo()
getNotificationInfo
in interface javax.management.NotificationBroadcaster
getNotificationInfo
in class javax.management.NotificationBroadcasterSupport
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |