Class InfinispanSessionDataStore
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.server.session.AbstractSessionDataStore
-
- org.eclipse.jetty.session.infinispan.InfinispanSessionDataStore
-
- All Implemented Interfaces:
SessionDataMap
,SessionDataStore
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
@ManagedObject public class InfinispanSessionDataStore extends AbstractSessionDataStore
InfinispanSessionDataStore
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.server.session.AbstractSessionDataStore
_context, _gracePeriodSec, _lastExpiryCheckTime, _savePeriodSec
-
-
Constructor Summary
Constructors Constructor Description InfinispanSessionDataStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
delete(java.lang.String id)
Delete session datajava.util.Set<java.lang.String>
doGetExpired(java.util.Set<java.lang.String> candidates)
Implemented by subclasses to resolve which sessions this node should attempt to expire.SessionData
doLoad(java.lang.String id)
Load the session from persistent store.protected void
doStart()
Starts the managed lifecycle beans in the order they were added.void
doStore(java.lang.String id, SessionData data, long lastSaveTime)
Store the session data persistently.boolean
exists(java.lang.String id)
Test if data exists for a given session id.org.infinispan.commons.api.BasicCache<java.lang.String,SessionData>
getCache()
Get the clustered cache instance.java.lang.String
getCacheKey(java.lang.String id)
int
getInfinispanIdleTimeoutSec()
QueryManager
getQueryManager()
boolean
isPassivating()
True if this type of datastore will passivate session objectsSessionData
newSessionData(java.lang.String id, long created, long accessed, long lastAccessed, long maxInactiveMs)
Create a new SessionDatavoid
setCache(org.infinispan.commons.api.BasicCache<java.lang.String,SessionData> cache)
Set the clustered cache instance.void
setInfinispanIdleTimeoutSec(int sec)
void
setQueryManager(QueryManager queryManager)
void
setSerialization(boolean serialization)
java.lang.String
toString()
-
Methods inherited from class org.eclipse.jetty.server.session.AbstractSessionDataStore
checkStarted, getExpired, getGracePeriodSec, getSavePeriodSec, initialize, load, setGracePeriodSec, setSavePeriodSec, store
-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStop, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
-
-
-
Method Detail
-
getCache
public org.infinispan.commons.api.BasicCache<java.lang.String,SessionData> getCache()
Get the clustered cache instance.- Returns:
- the cache
-
setCache
public void setCache(org.infinispan.commons.api.BasicCache<java.lang.String,SessionData> cache)
Set the clustered cache instance.- Parameters:
cache
- the cache
-
getQueryManager
public QueryManager getQueryManager()
-
setQueryManager
public void setQueryManager(QueryManager queryManager)
-
doStart
protected void doStart() throws java.lang.Exception
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classAbstractSessionDataStore
- Throws:
java.lang.Exception
- See Also:
SessionDataMap.load(String)
-
doLoad
public SessionData doLoad(java.lang.String id) throws java.lang.Exception
Description copied from class:AbstractSessionDataStore
Load the session from persistent store.- Specified by:
doLoad
in classAbstractSessionDataStore
- Parameters:
id
- the id of the session to load- Returns:
- the re-inflated session
- Throws:
java.lang.Exception
- if unable to load the session
-
delete
public boolean delete(java.lang.String id) throws java.lang.Exception
Description copied from interface:SessionDataMap
Delete session data- Parameters:
id
- identity of session to delete- Returns:
- true if the session was deleted
- Throws:
java.lang.Exception
- if unable to delete session data
-
doGetExpired
public java.util.Set<java.lang.String> doGetExpired(java.util.Set<java.lang.String> candidates)
Description copied from class:AbstractSessionDataStore
Implemented by subclasses to resolve which sessions this node should attempt to expire.- Specified by:
doGetExpired
in classAbstractSessionDataStore
- Parameters:
candidates
- the ids of sessions the SessionDataStore thinks has expired- Returns:
- the reconciled set of session ids that this node should attempt to expire
-
doStore
public void doStore(java.lang.String id, SessionData data, long lastSaveTime) throws java.lang.Exception
Description copied from class:AbstractSessionDataStore
Store the session data persistently.- Specified by:
doStore
in classAbstractSessionDataStore
- Parameters:
id
- identity of session to storedata
- info of the sessionlastSaveTime
- time of previous save or 0 if never saved- Throws:
java.lang.Exception
- if unable to store data
-
getCacheKey
public java.lang.String getCacheKey(java.lang.String id)
-
isPassivating
@ManagedAttribute(value="does store serialize sessions", readonly=true) public boolean isPassivating()
Description copied from interface:SessionDataStore
True if this type of datastore will passivate session objects- Returns:
- true if this store can passivate sessions, false otherwise
-
exists
public boolean exists(java.lang.String id) throws java.lang.Exception
Description copied from interface:SessionDataStore
Test if data exists for a given session id.- Parameters:
id
- Identity of session whose existence should be checked- Returns:
- true if valid, non-expired session exists
- Throws:
java.lang.Exception
- if problem checking existence with persistence layer
-
newSessionData
public SessionData newSessionData(java.lang.String id, long created, long accessed, long lastAccessed, long maxInactiveMs)
Description copied from interface:SessionDataStore
Create a new SessionData- Specified by:
newSessionData
in interfaceSessionDataStore
- Overrides:
newSessionData
in classAbstractSessionDataStore
- Parameters:
id
- the idcreated
- the timestamp when createdaccessed
- the timestamp when accessedlastAccessed
- the timestamp when last accessedmaxInactiveMs
- the max inactive time in milliseconds- Returns:
- a new SessionData object
-
setInfinispanIdleTimeoutSec
public void setInfinispanIdleTimeoutSec(int sec)
- Parameters:
sec
- the infinispan-specific idle timeout in sec or 0 if not set
-
getInfinispanIdleTimeoutSec
@ManagedAttribute(value="infinispan idle timeout sec", readonly=true) public int getInfinispanIdleTimeoutSec()
-
setSerialization
public void setSerialization(boolean serialization)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractSessionDataStore
-
-