|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectome.services.sessions.state.SessionCache
public class SessionCache
Synchronized and lockable state for the SessionManager
. Maps from
Session
uuid to SessionContext
in memory, with each mapping
also having an additional cache which may spill over to disk,
listeners
.
Uses ConcurrentHashMap
and various implementations from
java.util.concurrent.atomic to provide a lock-free implementation.
ticket:3173
Nested Class Summary | |
---|---|
static interface |
SessionCache.StaleCacheListener
Observer pattern used to refresh sessions in doUpdate. |
Constructor Summary | |
---|---|
SessionCache()
|
Method Summary | |
---|---|
boolean |
addSessionCallback(String session,
SessionCallback cb)
|
protected net.sf.ehcache.Ehcache |
createCache(String key,
boolean inMemory,
int maxInMemory)
|
void |
doUpdate()
Will only ever be accessed by a single thread. |
Set<String> |
getIds()
Since all methods which use getIds() will subsequently check for
the existing session, we do not block here. |
long |
getLastUpdated()
|
SessionContext |
getSessionContext(String uuid)
Retrieve a session possibly raising either RemovedSessionException or SessionTimeoutException . |
net.sf.ehcache.Ehcache |
inMemoryCache(String uuid)
|
net.sf.ehcache.Ehcache |
onDiskCache(String uuid)
|
void |
putSession(String uuid,
SessionContext sessionContext)
Puts a session blindly into the context. |
void |
refresh(String uuid,
SessionContext replacement)
Used externally to refresh the SessionContext instance
associated with the session uuid |
void |
reload(String id)
Provides the reloading logic of the SessionCache for the
SessionManagerImpl to use. |
void |
removeSession(String uuid)
|
boolean |
removeSessionCallback(String session,
SessionCallback cb)
|
void |
setApplicationContext(org.springframework.context.ApplicationContext ctx)
Context injector. |
void |
setCacheManager(net.sf.ehcache.CacheManager manager)
Injection method, also performs the creation of sessions |
void |
setStaleCacheListener(SessionCache.StaleCacheListener staleCacheListener)
|
void |
setUpdateInterval(long milliseconds)
Inject time in milliseconds between updates. |
void |
updateEvent(UserGroupUpdateEvent ugue)
Marks a new update request in State#lastUpdateRequest . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SessionCache()
Method Detail |
---|
public void setCacheManager(net.sf.ehcache.CacheManager manager)
sessions
public void setApplicationContext(org.springframework.context.ApplicationContext ctx) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void setUpdateInterval(long milliseconds)
public void setStaleCacheListener(SessionCache.StaleCacheListener staleCacheListener)
public boolean addSessionCallback(String session, SessionCallback cb)
public boolean removeSessionCallback(String session, SessionCallback cb)
public void putSession(String uuid, SessionContext sessionContext)
public void refresh(String uuid, SessionContext replacement)
SessionContext
instance
associated with the session uuid
id
- replacement
- public SessionContext getSessionContext(String uuid)
RemovedSessionException
or SessionTimeoutException
.
public void removeSession(String uuid)
public Set<String> getIds()
getIds()
will subsequently check for
the existing session, we do not block here. Blocking is primarily useful
for post-admintype changes which can add or remove a user from a group.
The existence of a session (which is what getIds specifies) is not
significantly effected.
public net.sf.ehcache.Ehcache inMemoryCache(String uuid)
public net.sf.ehcache.Ehcache onDiskCache(String uuid)
protected net.sf.ehcache.Ehcache createCache(String key, boolean inMemory, int maxInMemory)
public long getLastUpdated()
public void updateEvent(UserGroupUpdateEvent ugue)
State#lastUpdateRequest
. If the
timestamp on the event is invalid, then
System.currentTimeMillis()
will be used.
public void doUpdate()
#lastUpdateRun
gets set to a negative value to specify that this
method is currently running.
public void reload(String id)
SessionCache
for the
SessionManagerImpl
to use.
ticket:4011
,
ticket:5849
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: 4.3.3-00d1137e-b2894
Copyright © 2009 The University of Dundee. All Rights Reserved.