Top Description Fields Constructors Methods
org.eclipse.jetty.session

public Class NullSessionCache

extends AbstractSessionCache
Class Inheritance
Imports
java.util.function.Function, org.eclipse.jetty.server.Session, org.slf4j.Logger, .LoggerFactory

Does not actually cache any Session objects. Useful for testing. Also useful if you do not want to share Session objects with the same id between simultaneous requests: note that this means that context forwarding can't share the same id either.

Field Summary

Modifier and TypeField and Description
private static final Logger
Inherited from org.eclipse.jetty.session.AbstractSessionCache:
_context_evictionPolicy_flushOnResponseCommit_invalidateOnShutdown_manager_removeUnloadableSessions_saveOnCreate_saveOnInactiveEviction_sessionDataStore

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected ManagedSession
doComputeIfAbsent(String
the session id
id
,
Function<String, ManagedSession>
the function to load the data for the session
mappingFunction
)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doComputeIfAbsent.

Compute the mappingFunction to create a Session object iff the session with the given id isn't already in the map, otherwise return the existing Session.

public ManagedSession
doDelete(String
the id
id
)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doDelete.

Remove the session with this identity from the store

public ManagedSession
doGet(String
session id
id
)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doGet.

Get the session matching the key from the cache.

public Session
doPutIfAbsent(String
the identity of the session
id
,
ManagedSession
the session object
session
)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doPutIfAbsent.

Put the session into the map if it wasn't already there

public boolean
doReplace(String
the id
id
,
ManagedSession
the old value
oldValue
,
ManagedSession
the new value
newValue
)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doReplace.

Replace the mapping from id to oldValue with newValue

public ManagedSession
newSession(SessionData
the session data
data
)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.newSession.

Implements org.eclipse.jetty.session.SessionCache.newSession.

Create a new Session object from pre-existing session data

public void
setEvictionPolicy(int
-1 is never evict; 0 is evict-on-exit; and any other positive value is the time in seconds that a session can be idle before it can be evicted.
evictionTimeout
)

Overrides org.eclipse.jetty.session.AbstractSessionCache.setEvictionPolicy.

Implements org.eclipse.jetty.session.SessionCache.setEvictionPolicy.

-1 means we never evict inactive sessions.

public void
Inherited from org.eclipse.jetty.session.AbstractSessionCache:
addcheckExpirationcheckInactiveSessioncommitcontainsdeletedoStartdoStopexistsgetgetAndEntergetEvictionPolicygetSessionDataStoregetSessionManagerinitializeisFlushOnResponseCommitisInvalidateOnShutdownisRemoveUnloadableSessionsisSaveOnCreateisSaveOnInactiveEvictionnewSessionreleaserenewSessionIdrenewSessionIdsetFlushOnResponseCommitsetInvalidateOnShutdownsetRemoveUnloadableSessionssetSaveOnCreatesetSaveOnInactiveEvictionsetSessionDataStoretoString

Field Detail

LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.session.AbstractSessionCache.LOG.

Constructor Detail

NullSessionCacheback to summary
public NullSessionCache(SessionManager manager)

Method Detail

doComputeIfAbsentback to summary
protected ManagedSession doComputeIfAbsent(String id, Function<String, ManagedSession> mappingFunction)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doComputeIfAbsent.

Doc from org.eclipse.jetty.session.AbstractSessionCache.doComputeIfAbsent.

Compute the mappingFunction to create a Session object iff the session with the given id isn't already in the map, otherwise return the existing Session. This method is expected to have precisely the same behaviour as java.util.concurrent.ConcurrentHashMap#computeIfAbsent

Parameters
id:String

the session id

mappingFunction:Function<String, ManagedSession>

the function to load the data for the session

Returns:ManagedSession

an existing Session from the cache

Annotations
@Override
doDeleteback to summary
public ManagedSession doDelete(String id)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doDelete.

Doc from org.eclipse.jetty.session.AbstractSessionCache.doDelete.

Remove the session with this identity from the store

Parameters
id:String

the id

Returns:ManagedSession

Session that was removed or null

Annotations
@Override
doGetback to summary
public ManagedSession doGet(String id)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doGet.

Doc from org.eclipse.jetty.session.AbstractSessionCache.doGet.

Get the session matching the key from the cache. Does not load the session.

Parameters
id:String

session id

Returns:ManagedSession

the Session object matching the id

Annotations
@Override
doPutIfAbsentback to summary
public Session doPutIfAbsent(String id, ManagedSession session)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doPutIfAbsent.

Doc from org.eclipse.jetty.session.AbstractSessionCache.doPutIfAbsent.

Put the session into the map if it wasn't already there

Parameters
id:String

the identity of the session

session:ManagedSession

the session object

Returns:Session

null if the session wasn't already in the map, or the existing entry otherwise

Annotations
@Override
doReplaceback to summary
public boolean doReplace(String id, ManagedSession oldValue, ManagedSession newValue)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.doReplace.

Doc from org.eclipse.jetty.session.AbstractSessionCache.doReplace.

Replace the mapping from id to oldValue with newValue

Parameters
id:String

the id

oldValue:ManagedSession

the old value

newValue:ManagedSession

the new value

Returns:boolean

true if replacement was done

Annotations
@Override
newSessionback to summary
public ManagedSession newSession(SessionData data)

Implements abstract org.eclipse.jetty.session.AbstractSessionCache.newSession.

Implements org.eclipse.jetty.session.SessionCache.newSession.

Doc from org.eclipse.jetty.session.AbstractSessionCache.newSession.

Create a new Session object from pre-existing session data

Parameters
data:SessionData

the session data

Returns:ManagedSession

a new Session object

Annotations
@Override
setEvictionPolicyback to summary
public void setEvictionPolicy(int evictionTimeout)

Overrides org.eclipse.jetty.session.AbstractSessionCache.setEvictionPolicy.

Implements org.eclipse.jetty.session.SessionCache.setEvictionPolicy.

Doc from org.eclipse.jetty.session.AbstractSessionCache.setEvictionPolicy.

-1 means we never evict inactive sessions. 0 means we evict a session after the last request for it exits >0 is the number of seconds after which we evict inactive sessions from the cache

Parameters
evictionTimeout:int

Doc from org.eclipse.jetty.session.SessionCache.setEvictionPolicy.

-1 is never evict; 0 is evict-on-exit; and any other positive value is the time in seconds that a session can be idle before it can be evicted.

Annotations
@Override
shutdownback to summary
public void shutdown()

Implements org.eclipse.jetty.session.SessionCache.shutdown.

Annotations
@Override