nl.justobjects.pushlet.core
Class SessionManager

java.lang.Object
  extended bynl.justobjects.pushlet.core.SessionManager
All Implemented Interfaces:
ConfigDefs

public class SessionManager
extends java.lang.Object
implements ConfigDefs

Manages lifecycle of Sessions.

Version:
$Id: SessionManager.java,v 1.11 2007/11/23 14:33:07 justb Exp $
Author:
Just van den Broecke - Just Objects ©

Nested Class Summary
private  class SessionManager.AgingTimerTask
          Manages session timeouts.
 
Field Summary
private static SessionManager instance
          Singleton pattern: single instance.
private  Session[] sessionCache
          Shadow cache of active Sessions.
private  boolean sessionCacheDirty
          Flag indicating subscriptions have changed.
private  java.util.Map sessions
          Map of active sessions, keyed by their id.
private  java.util.Timer timer
          Timer to schedule session leasing TimerTasks.
private  long TIMER_INTERVAL_MILLIS
           
 
Fields inherited from interface nl.justobjects.pushlet.core.ConfigDefs
CONTROLLER_CLASS, DISPATCHER_CLASS, LISTEN_FORCE_PULL_AGENTS, LISTEN_FORCE_PULL_ALL, LOG_LEVEL, LOGGER_CLASS, POLL_REFRESH_TIMEOUT_MILLIS, POLL_REFRESH_WAIT_MAX_MILLIS, POLL_REFRESH_WAIT_MIN_MILLIS, PULL_REFRESH_TIMEOUT_MILLIS, PULL_REFRESH_WAIT_MAX_MILLIS, PULL_REFRESH_WAIT_MIN_MILLIS, QUEUE_READ_TIMEOUT_MILLIS, QUEUE_SIZE, QUEUE_WRITE_TIMEOUT_MILLIS, SESSION_CLASS, SESSION_ID_GENERATION, SESSION_ID_GENERATION_RANDOMSTRING, SESSION_ID_GENERATION_UUID, SESSION_ID_SIZE, SESSION_MANAGER_CLASS, SESSION_TIMEOUT_MINS, SOURCES_ACTIVATE, SUBSCRIBER_CLASS, SUBSCRIPTION_CLASS
 
Constructor Summary
protected SessionManager()
          Singleton pattern: protected constructor needed for derived classes.
 
Method Summary
 void addSession(Session session)
          Add session.
 Session createSession(Event anEvent)
          Create new Session (but add later).
 java.lang.String createSessionId()
          Create unique Session id.
private  void debug(java.lang.String s)
          Util: stdout printing.
static SessionManager getInstance()
          Singleton pattern: get single instance.
 Session getSession(java.lang.String anId)
          Get number of listening Sessions.
 int getSessionCount()
          Get number of listening Sessions.
 Session[] getSessions()
          Get copy of listening Sessions.
 Session[] getSnapshot()
           
 java.lang.String getStatus()
          Get status info.
 boolean hasSession(java.lang.String anId)
          Is Session present?.
private  void info(java.lang.String s)
          Util: stdout printing.
 Session removeSession(Session aSession)
          Register session for removal.
 void start()
          Util: stdout printing.
 void stop()
          Util: stdout printing.
private  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

instance

private static SessionManager instance
Singleton pattern: single instance.


timer

private java.util.Timer timer
Timer to schedule session leasing TimerTasks.


TIMER_INTERVAL_MILLIS

private final long TIMER_INTERVAL_MILLIS
See Also:
Constant Field Values

sessions

private java.util.Map sessions
Map of active sessions, keyed by their id.


sessionCache

private Session[] sessionCache
Shadow cache of active Sessions.


sessionCacheDirty

private volatile boolean sessionCacheDirty
Flag indicating subscriptions have changed.

Constructor Detail

SessionManager

protected SessionManager()
Singleton pattern: protected constructor needed for derived classes.

Method Detail

createSession

public Session createSession(Event anEvent)
                      throws PushletException
Create new Session (but add later).

Throws:
PushletException

createSessionId

public java.lang.String createSessionId()
Create unique Session id.


getInstance

public static SessionManager getInstance()
Singleton pattern: get single instance.


getSession

public Session getSession(java.lang.String anId)
Get number of listening Sessions.


getSessions

public Session[] getSessions()
Get copy of listening Sessions.


getSessionCount

public int getSessionCount()
Get number of listening Sessions.


getStatus

public java.lang.String getStatus()
Get status info.


hasSession

public boolean hasSession(java.lang.String anId)
Is Session present?.


addSession

public void addSession(Session session)
Add session.


removeSession

public Session removeSession(Session aSession)
Register session for removal.


getSnapshot

public Session[] getSnapshot()

start

public void start()
Util: stdout printing.


stop

public void stop()
Util: stdout printing.


info

private void info(java.lang.String s)
Util: stdout printing.


warn

private void warn(java.lang.String s)
Util: stdout printing.


debug

private void debug(java.lang.String s)
Util: stdout printing.



Copyright © 2000-2003 - Just Objects B.V.