|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.marketcetera.util.ws.stateful.SessionManager<T>
public class SessionManager<T>
A session manager. It maps session IDs (SessionId) to
session holders (SessionHolder), and (optionally)
automatically expires sessions (map entries) which remain unused
for a time interval that exceeds the session lifespan. This
expiration is performed at regular intervals by a reaper thread,
initiated during construction as part of the caller's thread group;
the interval between scans is normally 5% of the session lifespan.
| Field Summary | |
|---|---|
static long |
INFINITE_SESSION_LIFESPAN
A sentinel value for an infinite session lifespan (non-expiring sessions). |
static long |
MAX_SCAN_INTERVAL
The maximum sleep interval between reaper scans, in ms. |
| Constructor Summary | |
|---|---|
SessionManager()
Creates a new session manager whose sessions never expire. |
|
SessionManager(long sessionLife)
Creates a new session manager whose sessions have the given lifespan, in ms. |
|
SessionManager(SessionFactory<T> sessionFactory)
Creates a new session manager whose sessions are created by the given factory, and which never expire. |
|
SessionManager(SessionFactory<T> sessionFactory,
long sessionLife)
Creates a new session manager whose sessions are created by the given factory, and which have the given lifespan, in ms. |
|
| Method Summary | |
|---|---|
SessionHolder<T> |
get(SessionId id)
Returns the holder that the receiver associates with the given session ID. |
long |
getLifespan()
Returns the lifespan of the sessions managed by the receiver. |
NodeId |
getServerId()
Returns the receiver's server ID. |
SessionFactory<T> |
getSessionFactory()
Returns the receiver's session factory. |
void |
put(SessionId id,
SessionHolder<T> holder)
Adds the given holder, associated with the given session ID, to the receiver. |
void |
remove(SessionId id)
Removes the holder that the receiver associates with the given session ID. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long MAX_SCAN_INTERVAL
public static final long INFINITE_SESSION_LIFESPAN
| Constructor Detail |
|---|
public SessionManager(SessionFactory<T> sessionFactory,
long sessionLife)
sessionFactory - The session factory. It may be null.sessionLife - The lifespan. Use INFINITE_SESSION_LIFESPAN for an infinite lifespan.public SessionManager(long sessionLife)
sessionLife - The lifespan. Use INFINITE_SESSION_LIFESPAN for an infinite lifespan.public SessionManager(SessionFactory<T> sessionFactory)
sessionFactory - The session factory. It may be null.public SessionManager()
| Method Detail |
|---|
public NodeId getServerId()
public SessionFactory<T> getSessionFactory()
public long getLifespan()
public void put(SessionId id,
SessionHolder<T> holder)
id - The session ID.holder - The holder.public SessionHolder<T> get(SessionId id)
id - The session ID.
public void remove(SessionId id)
id - The session ID.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||