|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnl.justobjects.pushlet.core.SessionManager
public class SessionManager
Manages lifecycle of Sessions.
| Nested Class Summary | |
|---|---|
private class |
SessionManager.AgingTimerTask
Manages Session timeouts. |
| Field Summary | |
|---|---|
private static SessionManager |
instance
Singleton pattern: single instance. |
private java.lang.Object |
mutex
Lock for any operation on Sessions (Session Map and/or -cache). |
private Session[] |
sessionCache
Cache of Sessions for iteration and to allow concurrent modification. |
private boolean |
sessionCacheDirty
State of SessionCache, becomes true whenever sessionCache out of sync with sessions Map. |
private java.util.Map |
sessions
Map of active sessions, keyed by their id, all access is through mutex. |
private java.util.Timer |
timer
Timer to schedule session leasing TimerTasks. |
private long |
TIMER_INTERVAL_MILLIS
|
| Constructor Summary | |
|---|---|
protected |
SessionManager()
Singleton pattern: protected constructor needed for derived classes. |
| Method Summary | |
|---|---|
void |
addSession(Session session)
Add session. |
void |
apply(java.lang.Object visitor,
java.lang.reflect.Method method,
java.lang.Object[] args)
Visitor pattern implementation for Session iteration. |
Session |
createSession(Event anEvent)
Create new Session (but add later). |
protected java.lang.String |
createSessionId()
Create unique Session id. |
protected void |
debug(java.lang.String s)
Util: stdout printing. |
static SessionManager |
getInstance()
Singleton pattern: get single instance. |
Session |
getSession(java.lang.String anId)
Get Session by session id. |
int |
getSessionCount()
Get number of listening Sessions. |
Session[] |
getSessions()
Get copy of listening Sessions. |
java.lang.String |
getStatus()
Get status info. |
boolean |
hasSession(java.lang.String anId)
Is Session present?. |
protected void |
info(java.lang.String s)
Util: stdout printing. |
Session |
removeSession(Session aSession)
Register session for removal. |
void |
start()
Starts us. |
void |
stop()
Stopis us. |
protected void |
warn(java.lang.String s)
Util: stdout printing. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static SessionManager instance
private java.util.Timer timer
private final long TIMER_INTERVAL_MILLIS
private java.util.Map sessions
private Session[] sessionCache
private boolean sessionCacheDirty
private final java.lang.Object mutex
| Constructor Detail |
|---|
protected SessionManager()
| Method Detail |
|---|
public void apply(java.lang.Object visitor,
java.lang.reflect.Method method,
java.lang.Object[] args)
visitor - the object that should implement method parmmethod - the method to be called from visitorargs - arguments to be passed in visit method, args[0] will always be Session object
public Session createSession(Event anEvent)
throws PushletException
PushletExceptionpublic static SessionManager getInstance()
public Session getSession(java.lang.String anId)
public Session[] getSessions()
public int getSessionCount()
public java.lang.String getStatus()
public boolean hasSession(java.lang.String anId)
public void addSession(Session session)
public Session removeSession(Session aSession)
public void start()
throws PushletException
PushletExceptionpublic void stop()
protected java.lang.String createSessionId()
protected void info(java.lang.String s)
protected void warn(java.lang.String s)
protected void debug(java.lang.String s)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||