public abstract class AbstractHttpSessionCollection extends Base implements CoherenceHttpSessionCollection
Modifier and Type | Class and Description |
---|---|
static class |
AbstractHttpSessionCollection.ApplicationScopeController
A simple implementation of the AttributeScopeController interface that
scopes all attributes to the application by prepending the name of the
application to all attribute names.
|
static class |
AbstractHttpSessionCollection.DistributedController
A simple implementation of the SessionDistributionController interface
that forces all sessions (and thus their attributes) to be managed
in a distributed manner.
|
static class |
AbstractHttpSessionCollection.GlobalScopeController
A simple implementation of the AttributeScopeController interface that
does not scope attributes.
|
static class |
AbstractHttpSessionCollection.HybridController
A simple implementation of the SessionDistributionController interface
that forces all sessions and serializable attributes to be managed
in a distributed manner.
|
static class |
AbstractHttpSessionCollection.LocalController
A simple implementation of the SessionDistributionController interface
that forces all sessions (and thus their attributes) to be managed
locally.
|
Base.LoggingWriter, Base.StackFrame
HttpSessionCollection.AttributeScopeController, HttpSessionCollection.SessionDistributionController
Modifier and Type | Field and Description |
---|---|
static String |
CACHENAME_LOCAL_ATTRIBUTES
The name of the local cache that stores the session attributes that are
not distributed (if there is a distribution controller or attributes
are allowed to become local when serialization fails).
|
static String |
CACHENAME_LOCAL_SESSIONS
The name of the local cache that stores the sessions that are not yet
distributed (if there is a distribution controller).
|
static String |
CACHENAME_SESSIONS
The name of the clustered cache that stores the sessions.
|
static String |
CTX_INIT_ENABLE_SESSION_ACCESS_DEBUG_LOGGING
Configuration property to enable debug logging for Session access.
|
static String |
CTX_INIT_SESSION_ACCESS_DEBUG_LOGGING_FILTER
Configuration property to enable debug logging for Session access.
|
protected ConcurrentHashMap<String,String> |
f_mapLocks
Data structure for recording lock and unlock calls of session IDs
for triaging Bug 27854987
|
static String |
SERVICENAME_OWNERSHIP
The name of the clustered invocation service that manages sticky
session ownership.
|
Constructor and Description |
---|
AbstractHttpSessionCollection()
Default constructor (required).
|
Modifier and Type | Method and Description |
---|---|
void |
activate(String sId,
javax.servlet.http.HttpSession session)
Move the session into an active state, if it is not already.
|
void |
addHttpSessionAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)
Sign up the specified listener to receive HttpSessionBindingEvent
objects.
|
void |
addHttpSessionListener(javax.servlet.http.HttpSessionListener listener)
Sign up the specified listener to receive HttpSessionEvent objects.
|
protected void |
cleanUpDeletedSessions(Set<String> setDeletedIds)
Clean up the HttpSession objects that are no longer alive.
|
protected void |
clearClusterCache()
Clear the cluster cache reference.
|
void |
configure(XmlElement xml,
SessionHelper sessionHelper)
Configure the session collection using the xml document.
|
HttpSessionModel |
create(javax.servlet.http.HttpSession session)
This method creates a new session, returning the session model for the
new session.
|
AbstractHttpSessionModel |
create(javax.servlet.http.HttpSession session,
String sId)
This method attempts to create a new session with a specific ID,
returning the session model for the new session.
|
Set<String> |
deleteExpiredLocalSessions()
Deletes the locally opened sessions in the session-cache which have timed out, using an EntryProcessor
and return the ids of the deleted sessions.
|
Set<String> |
deleteExpiredSessions()
Delete the sessions in the session-cache which have timed out, using an EntryProcessor
and return the ids of deleted sessions.
|
protected void |
deleteModelFromLocalCaches(String sId) |
void |
destroy(String sId)
Destroy the specified session.
|
protected void |
destroyLocalAttributesCache(String sId)
Destroy the cache of local-only session attributes for the specified
session ID.
|
NamedCache |
ensureClusterCache()
Ensure the cache of existent distributed session models.
|
protected Map |
ensureLocalAttributesCache(String sId)
Get the cache of local-only session attributes for the specified
session ID.
|
boolean |
enter(String sId,
boolean fWait)
Obtain any necessary ownership for the specified session.
|
boolean |
enter(String sId,
boolean fWait,
boolean fExclusive)
Obtain any necessary ownership for the specified session.
|
void |
exit(String sId,
boolean fFlush)
Release ownership for the specified session.
|
void |
exit(String sId,
boolean fFlush,
boolean fExclusive)
Release ownership for the specified session.
|
protected void |
fireSessionDestroyedListeners(String sId,
AbstractHttpSessionModel model) |
protected String |
generateSessionId()
Generate a potential session ID.
|
HttpSessionModel |
get(String sId)
Obtain the HttpSessionModel for the specified session, or null if it
does not exist.
|
protected NamedCache |
getActiveCache()
Get the cache of active sessions.
|
protected NamedCache |
getAppControlCache()
Get the cache used to control concurrent access to a session by
multiple applications, if application locking is used.
|
int |
getAverageModelLifetime()
Calculate the average lifetime (in seconds) of session model objects
invalidated (either due to expiration or to an explicit invalidation)
since the last time statistics were reset.
|
int |
getAverageModelSize()
Calculate the average size (in bytes) of session model objects placed in
the session storage clustered cache since the last time statistics were
reset.
|
protected CacheDelegator |
getCacheDelegator()
Get the cache delegator.
|
NamedCache |
getClusterCache()
Get the cache of existent distributed session models.
|
protected AbstractHttpSessionCollection |
getCollection()
Obtain the AbstractHttpSessionCollection that is being used in the
current application.
|
XmlElement |
getConfig()
Get the XML configuration document.
|
protected long |
getCurrentTime()
Determine the current time value in milliseconds.
|
int |
getDefaultMaxInactiveInterval()
Determine the default maximum interval, in seconds, that a session will
be kept alive without any activity.
|
protected String |
getDescription()
Returns a string representation of this object's attributes.
|
protected HttpSessionCollection.SessionDistributionController |
getDistributionController()
Get the SessionDistributionController for the session collection, if
one was specified.
|
protected Listeners |
getHttpSessionAttributeListeners()
Determine the list of listeners that are registered for session
attribute modification events.
|
protected com.tangosol.coherence.servlet.HttpSessionCollectionConfiguration |
getHttpSessionCollectionConfiguration()
Get the instantiated Configuration
|
protected Listeners |
getHttpSessionListeners()
Determine the list of listeners that are registered for session life
cycle events.
|
NamedCache |
getLocalAttributesCache()
Get the cache of local-only session attributes.
|
NamedCache |
getLocalCache()
Get the cache of existent local-only session models.
|
String |
getLocalCacheName()
Get the local-only session model cache name
|
Set<String> |
getLocalSessionIds()
Returns the set of ids locally opened session.
|
Set<String> |
getLocalSessonIdsSnapshot()
Returns a snapshot of the set of ids locally opened session.
|
int |
getMaxModelSize()
Return the maximum size (in bytes) of a session model object placed in the
session storage clustered cache since the last time statistics were reset.
|
int |
getMinModelSize()
Return the minimum size (in bytes) of a session model object placed in the
session storage clustered cache since the last time statistics were reset.
|
protected AbstractHttpSessionModel |
getModel(String sId)
Obtain the specified session model.
|
protected AbstractHttpSessionModel |
getModel(String sId,
boolean fLite)
Obtain the specified session model.
|
int |
getModelDeaths()
Return the number of session model objects invalidated (either due to
expiration or to an explicit invalidation) since the last time statistics
were reset.
|
int |
getModelUpdates()
Return the number of updates to session model objects since the last time
statistics were reset.
|
protected NamedCache |
getOwnedCache()
Get the cache of owned ("locally live") session models.
|
protected AbstractHttpSessionModel |
getOwnedModel(String sId)
Obtain the specified session model that this thread owns, otherwise
throw an exception.
|
protected HttpSessionCollection.AttributeScopeController |
getScopeController()
Get the AttributeScopeController for the session collection, if one was
specified.
|
Serializer |
getSerializer()
Get the serializer used to serialize and deserialize session attributes.
|
protected String |
getSessionAccessDebugLoggingFilter()
Get the Session Access Debug Logging attribute filter
|
protected Filter |
getSessionExpiryFilter()
Generates a session expiry filter based on the configured factories.
|
HttpSessionIdGenerator |
getSessionIdGenerator()
Retrieve the HttpSessionIdGenerator used by this session collection to
generate session identifiers.
|
int |
getSessionIdLength()
Determine the length that session IDs will be created with.
|
protected Member |
getSessionOwnershipInfo(String sId)
Determine which cluster member (if any) holds the lock for the given
session ID.
|
NamedCache |
getStickyCache()
Get the cache of information about sessions that are stuck to this
member, if sticky ownership is used.
|
NamedCache |
getStickyExitTaskCache()
Get the cache of session ExitTasks for sessions that are stuck to this
member, if sticky ownership is used.
|
protected InvocationService |
getStickyService()
Get the invocation service to use to manage sticky session ownership.
|
protected abstract AbstractHttpSessionModel |
instantiateModel(javax.servlet.http.HttpSession session,
String sId)
Factory Method: Instantiate a AbstractHttpSessionModel or subclass
thereof.
|
boolean |
isActive(String sId)
Determine if the specified session ID identifies a session that is in
the active state.
|
protected boolean |
isAllowLocalAttributes()
Determine if non-serializable attributes should be preserved as local.
|
protected boolean |
isAppLockingEnforced()
Determine whether or not two or more applications should be prevented
from accessing the same session simultaneously.
|
protected boolean |
isAssumeLocality()
Determine if it can be assumed that each existent session is managed on
a server that is doing reaping, and thus each server can reap only the
sessions that are managed on it.
|
protected boolean |
isEnableAttributeListenerOptimization()
Determines if attribute listeners should be executed if the same instance
of a session attribute is being replaced in the session.
|
protected boolean |
isEnabledSessionAccessDebugLogging()
Determine if Session Access Debug Logging is Enabled
|
protected boolean |
isEnableSuspectAttributes()
Determine if suspect attributes need special treatment.
|
boolean |
isExistent(String sId)
Determine if the specified session ID identifies a session that exists.
|
protected boolean |
isMemberLockingEnforced()
Determine whether or not two or more JVMs should be prevented from
accessing the same session simultaneously.
|
boolean |
isOwned(String sId)
Determine if the specified session ID identifies a session that exists
and that this thread has ownership for, either by a call to
enter(sId) or create() without a
corresponding call to exit(sId) . |
boolean |
isOwnershipSticky()
Determine if the sticky session ownership option is on.
|
protected boolean |
isSessionLockingEnforced()
Determine whether concurrent access to a session is permitted.
|
boolean |
isStrict()
Determine if the Servlet specification is being followed strictly.
|
protected boolean |
isStuck(String sId)
Determine if the specified session is stuck.
|
protected boolean |
isThreadLockingEnforced()
Determine whether a session should be single threaded (only one request
per session accessing the session at a time) or multithreaded (any
number of requests accessing the session at a time).
|
Iterator |
iterateIds()
Obtain an iterator of the session IDs.
|
Iterator |
iteratePotentiallyExpiredIds()
Obtain an iterator of the session IDs that this JVM is responsible
for invalidating when the sessions for those IDs have timed out.
|
Iterator |
iteratePotentiallyExpiredLocalIds()
Obtain an iterator of the locally opened session IDs that are opened
in this web application instance and have timed out.
|
boolean |
logInvalidationExceptions()
Determine whether to log exceptions thrown by the session during
invalidation.
|
protected boolean |
obtainAppOwnership(String sId,
boolean fWait)
Obtain application ownership for the specified session.
|
protected boolean |
obtainClusterOwnership(String sId,
boolean fWait)
Obtain ownership within the cluster for the specified session.
|
protected boolean |
obtainThreadOwnership(String sId)
Obtain thread ownership of the specified session, if necessary.
|
protected void |
onModelUpdate(int cb)
Notify the session collection that a model of the specified size (in
bytes) was updated in the session storage clustered cache.
|
void |
passivate(String sId)
Move the session into a passive state, if it is not already.
|
void |
postCreate(javax.servlet.http.HttpSession session)
This method is called at the end of the session creation process.
|
protected static void |
putBlind(Map map,
Object oKey,
Object oValue)
Puts the specified key/value pair into the specified map using the
putAll() method, which does not return the previous value and thus
may be more efficient in a distributed environment.
|
protected void |
recordMapLocksState(String sKey,
String sValue)
Method to record mapLocks state
|
protected void |
releaseAppOwnership(String sId)
Release application ownership of the specified session.
|
void |
releaseCache(NamedCache cache)
Release the passed NamedCache instance.
|
protected void |
releaseClusterOwnership(String sId)
Release ownership within the cluster of the specified session.
|
protected boolean |
releaseStuckSession(String sId,
boolean fWait)
Determine if the specified session is stuck, and if it is, to release
it (or mark it to be released).
|
protected boolean |
releaseThreadOwnership(String sId)
Release thread ownership of the specified session.
|
protected void |
remapSessionId(AbstractHttpSessionModel model) |
protected static void |
removeAllBlind(Map map,
Set<Object> colKeys)
Removes the specified key/value pairs from the specified map using the
keySet().removeAll() method, which does not return the previous value and
thus may be more efficient in a distributed environment.
|
protected static void |
removeBlind(Map map,
Object oKey)
Removes the specified key/value pair from the specified map using the
keySet().remove() method, which does not return the previous value and
thus may be more efficient in a distributed environment.
|
void |
removeHttpSessionAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)
Sign off the specified listener so it no longer will receive
HttpSessionBindingEvent objects.
|
void |
removeHttpSessionListener(javax.servlet.http.HttpSessionListener listener)
Sign off the specified listener so it no longer will receive
HttpSessionEvent objects.
|
protected Object |
removeMapLocksState(String sKey)
Method to remove mapLocks state
|
void |
resetStatistics()
Reset all statistics maintained by this session collection.
|
protected void |
setCacheDelegator(CacheDelegator cacheDelegator)
Set the cache delegator object.
|
protected void |
setConfiguration(com.tangosol.coherence.servlet.HttpSessionCollectionConfiguration config)
Set the configuration object.
|
void |
setSerializer(Serializer serializer)
Set the serializer used to serialize and deserialize session attributes.
|
void |
shutdown()
Notify the session collection that it is being shut down.
|
String |
toString()
Returns a string representation of the object.
|
protected void |
updateSessionStatitics(String sId,
AbstractHttpSessionModel model) |
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
public static final String CTX_INIT_ENABLE_SESSION_ACCESS_DEBUG_LOGGING
public static final String CTX_INIT_SESSION_ACCESS_DEBUG_LOGGING_FILTER
public static final String CACHENAME_SESSIONS
public static final String CACHENAME_LOCAL_SESSIONS
public static final String CACHENAME_LOCAL_ATTRIBUTES
public static final String SERVICENAME_OWNERSHIP
protected final ConcurrentHashMap<String,String> f_mapLocks
public AbstractHttpSessionCollection()
protected AbstractHttpSessionCollection getCollection()
public XmlElement getConfig()
public void configure(XmlElement xml, SessionHelper sessionHelper)
configure
in interface CoherenceHttpSessionCollection
xml
- the xml elementsessionHelper
- the session helperpublic HttpSessionModel create(javax.servlet.http.HttpSession session)
The session is created with the default timeout, and has an ID that is unique within the domain that the session management layer is configured for (e.g. within the JVM, or within the cluster.)
When the session model is returned, the session state is exists,
owned, active. Note that the responsibilities associated with
the enter()
method are included as part of the session
creation process.
The model will retain the reference to the HttpSession object until it is passivated or destroyed.
create
in interface HttpSessionCollection
session
- the HttpSession object to bind the session model to;
used for issuing events; must not be nullpublic void postCreate(javax.servlet.http.HttpSession session)
When this method is called, the session state is exists, owned, active.
postCreate
in interface HttpSessionCollection
session
- the HttpSession object; must not be nullpublic boolean isExistent(String sId)
The notion of ownership will affect whether or not the answer can be
trusted once the method has returned it. If the ownership state is
owned (the current thread called enter(sId)
),
then the caller should assume that session still exists. Otherwise,
the caller can only assume that the session did exist at the
point in time that the call to this method was made.
isExistent
in interface HttpSessionCollection
sId
- the session ID to check for existencepublic void destroy(String sId)
This method may only be called on a session that is exists, owned, active.
Session attributes will receive HttpSessionBindingListener as per the Servlet specification.
At the return point from this method, the session state is does
not exist. Note that the responsibilities associated with the
exit(sId)
method are included as part of the session
destruction process.
After this method completes, the model's HttpSession reference will be null.
destroy
in interface HttpSessionCollection
sId
- the session ID; must not be nullprotected void fireSessionDestroyedListeners(String sId, AbstractHttpSessionModel model)
protected void deleteModelFromLocalCaches(String sId)
protected void updateSessionStatitics(String sId, AbstractHttpSessionModel model)
public boolean enter(String sId, boolean fWait)
If the session specified by the session ID does not exist, then this method has no effect; no exception is thrown.
This method must support Multiple Possession Semantics, meaning
that this method may be invoked multiple times, and each invocation
will require a corresponding call to the exit(sId)
method
in order to release the ownership.
enter
in interface HttpSessionCollection
sId
- the session ID; must not be nullfWait
- true if the thread should block until the session becomes
available; false otherwisepublic boolean enter(String sId, boolean fWait, boolean fExclusive)
If the session specified by the session ID does not exist, then this method has no effect; no exception is thrown.
This method must support Multiple Possession Semantics, meaning
that this method may be invoked multiple times, and each invocation
will require a corresponding call to the exit(sId)
method
in order to release the ownership.
enter
in interface HttpSessionCollection
sId
- the session ID; must not be nullfWait
- true if the thread should block until the session
becomes available; false otherwisefExclusive
- if true, prevent other threads from entering the
specified session until a corresponding call to
HttpSessionCollection.exit(String, boolean, boolean)
is made by
the calling threadpublic boolean isOwned(String sId)
enter(sId)
or create()
without a
corresponding call to exit(sId)
.
NOTE! Since an asynchronous exit task could have been scheduled by
SessionHelper.requestAsyncOwnership(String)
, this method should
not be used to determine if exit should be called or not.
NOTE, since an asynchronous exit task could have been scheduled by
SessionHelper.requestAsyncOwnership(String)
, this method should
not be used to determine if exit should be called or not.
isOwned
in interface HttpSessionCollection
sId
- the session ID; must not be nullpublic void exit(String sId, boolean fFlush)
enter(sId)
,
with the only exceptions being:
enter(sId)
method was never invoked.When ownership state of a new session changes from owned to not owned, the session will no longer be considered new.
If the session specified by the session ID does not exist, then this method has no effect; no exception is thrown.
exit
in interface HttpSessionCollection
sId
- the session ID; must not be nullfFlush
- pass true if the session has been potentially modified;
even then, there's no guarantee that the session state
will be flushed if there is another thread that is
using the session concurrently. In this case, the last
exiting thread will flushpublic void exit(String sId, boolean fFlush, boolean fExclusive)
enter(sId)
,
with the only exceptions being:
enter(sId)
method was never invoked.When ownership state of a new session changes from owned to not owned, the session will no longer be considered new.
If the session specified by the session ID does not exist, then this method has no effect; no exception is thrown.
exit
in interface HttpSessionCollection
sId
- the session ID; must not be nullfFlush
- pass true if the session has been potentially
modified; even then, there's no guarantee that the
session state will be flushed if there is another
thread that is using the session concurrently. In
this case, the last exiting thread will flushfExclusive
- if true, a previous call to
HttpSessionCollection.enter(String, boolean, boolean)
should have
been made where the fExclusive was set to trueprotected void remapSessionId(AbstractHttpSessionModel model)
public void activate(String sId, javax.servlet.http.HttpSession session)
Invoking this method will issue activation events for session attributes that implement the HttpSessionActivationListener interface. The model will retain the reference to the HttpSession object until it is passivated or destroyed.
activate
in interface HttpSessionCollection
sId
- the session ID; must not be nullsession
- the HttpSession object to bind the session model to;
used for issuing events; must not be nullpublic boolean logInvalidationExceptions()
public boolean isActive(String sId)
This method may only be called within the bounds of a call to
enter(sId)
and exit(sId)
.
isActive
in interface HttpSessionCollection
sId
- the session ID to check for the active statepublic void passivate(String sId)
Invoking this method will issue passivation events for session attributes that implement the HttpSessionActivationListener interface.
After this method completes, the model's HttpSession reference will be null.
passivate
in interface HttpSessionCollection
sId
- the session ID; must not be nullpublic Set<String> deleteExpiredSessions()
deleteExpiredSessions
in interface HttpSessionCollection
public Set<String> deleteExpiredLocalSessions()
deleteExpiredLocalSessions
in interface HttpSessionCollection
protected void cleanUpDeletedSessions(Set<String> setDeletedIds)
setDeletedIds
- the set of deleted idspublic Iterator iterateIds()
The list of IDs is completely dynamic because of the nature of multi-threaded and distributed systems. The fact that an ID is returned from an iterator is no guarantee that the ID is still valid.
iterateIds
in interface HttpSessionCollection
public Iterator iteratePotentiallyExpiredIds()
This may return an iterator with the same contents as the one
returned by the HttpSessionCollection.iterateIds()
method, or it may return
an iterator that iterates over a subset of those contents.
The list of IDs is completely dynamic because of the nature of multi-threaded and distributed systems. The fact that an ID is returned from an iterator is no guarantee that the ID is still valid, or that it has expired.
iteratePotentiallyExpiredIds
in interface HttpSessionCollection
public Iterator iteratePotentiallyExpiredLocalIds()
iteratePotentiallyExpiredLocalIds
in interface HttpSessionCollection
protected Filter getSessionExpiryFilter()
public HttpSessionModel get(String sId)
This method may only be called within the bounds of a call to
enter(sId)
and exit(sId)
.
get
in interface HttpSessionCollection
sId
- the session ID; must not be nullpublic Set<String> getLocalSessionIds()
public Set<String> getLocalSessonIdsSnapshot()
public void addHttpSessionListener(javax.servlet.http.HttpSessionListener listener)
addHttpSessionListener
in interface HttpSessionCollection
listener
- the HttpSessionListener to sign up for eventspublic void removeHttpSessionListener(javax.servlet.http.HttpSessionListener listener)
removeHttpSessionListener
in interface HttpSessionCollection
listener
- the HttpSessionListener that was previously signed up
for eventspublic void addHttpSessionAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)
addHttpSessionAttributeListener
in interface HttpSessionCollection
listener
- the HttpSessionAttributeListener to sign up for eventspublic void removeHttpSessionAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)
removeHttpSessionAttributeListener
in interface HttpSessionCollection
listener
- the HttpSessionAttributeListener that was previously
signed up for eventspublic void shutdown()
shutdown
in interface HttpSessionCollection
public String toString()
protected Listeners getHttpSessionListeners()
protected Listeners getHttpSessionAttributeListeners()
protected com.tangosol.coherence.servlet.HttpSessionCollectionConfiguration getHttpSessionCollectionConfiguration()
public boolean isStrict()
public int getDefaultMaxInactiveInterval()
protected boolean isSessionLockingEnforced()
isMemberLockingEnforced()
or isAppLockingEnforced()
or
isMemberLockingEnforced()
return true, then so will this
method.
If this is set to false, then concurrent access is permitted and the last update wins.
protected boolean isMemberLockingEnforced()
protected boolean isAppLockingEnforced()
Note that application-level locking requires that member-level session
locking is enabled. In other words, if this method returns true, the
value of isMemberLockingEnforced()
will also be true.
protected boolean isThreadLockingEnforced()
Note that a single threaded session requires that both member-level and
application-level session locking are enabled. In other words, if this
method returns true, the value of isMemberLockingEnforced()
and isAppLockingEnforced()
will also be true.
protected long getCurrentTime()
protected boolean isEnabledSessionAccessDebugLogging()
protected String getSessionAccessDebugLoggingFilter()
public Serializer getSerializer()
getSerializer
in interface HttpSessionCollection
public void setSerializer(Serializer serializer)
setSerializer
in interface HttpSessionCollection
serializer
- a serializer; must not be nullpublic AbstractHttpSessionModel create(javax.servlet.http.HttpSession session, String sId)
The session is created with the default timeout.
When the session model is returned, the session state is exists,
owned, active. Note that the responsibilities associated with
the enter()
method are included as part of the session
creation process.
The model will retain the reference to the HttpSession object until it is passivated or destroyed.
create
in interface HttpSessionCollection
session
- the HttpSession object to bind the session model
to; used for issuing events; must not be nullsId
- the session idprotected String getDescription()
public NamedCache getStickyCache()
public NamedCache getStickyExitTaskCache()
protected InvocationService getStickyService()
protected NamedCache getAppControlCache()
protected NamedCache getActiveCache()
protected NamedCache getOwnedCache()
public NamedCache ensureClusterCache()
public NamedCache getClusterCache()
protected void clearClusterCache()
protected CacheDelegator getCacheDelegator()
protected void setCacheDelegator(CacheDelegator cacheDelegator)
cacheDelegator
- the cache delegatorprotected void setConfiguration(com.tangosol.coherence.servlet.HttpSessionCollectionConfiguration config)
config
- the configuration object.protected HttpSessionCollection.SessionDistributionController getDistributionController()
protected HttpSessionCollection.AttributeScopeController getScopeController()
public String getLocalCacheName()
public NamedCache getLocalCache()
public NamedCache getLocalAttributesCache()
protected Map ensureLocalAttributesCache(String sId)
sId
- the session IDprotected void destroyLocalAttributesCache(String sId)
sId
- the session IDpublic boolean isOwnershipSticky()
This is available only if an Enterprise Edition or Grid Edition license is available.
protected boolean isStuck(String sId)
sId
- the session idprotected Member getSessionOwnershipInfo(String sId)
sId
- the session IDprotected boolean obtainClusterOwnership(String sId, boolean fWait)
This method assumes that the owned cache is locked for the passed session id.
sId
- the id of the session to obtain ownership forfWait
- true to wait for the session to become available,
false to give up immediately if ownership of the
session is currently unavailableprotected void releaseClusterOwnership(String sId)
This method assumes that the owned cache is locked for the passed session ID.
sId
- the ID of the session to release ownership ofprotected boolean releaseStuckSession(String sId, boolean fWait)
sId
- the session id to unstick if it's stuck herefWait
- true to wait for the session to be release or be marked
to be released, false to give up immediately if ownership
of the session is currently unavailableprotected boolean obtainAppOwnership(String sId, boolean fWait)
This method assumes that the owned cache is locked for the passed session ID.
sId
- the ID of the session to obtain ownership forfWait
- true to wait for the session to become available,
false to give up immediately if ownership of the
session is currently unavailableprotected void releaseAppOwnership(String sId)
This method assumes that the owned cache is locked and cluster ownership has been obtained for the passed session ID.
sId
- the ID of the session to release ownership ofprotected boolean obtainThreadOwnership(String sId)
If thread locking is enforced this method has no effect and false is
returned; otherwise, the given ID is locked in the local owned cache
and true is returned. A return value of true implies that
releaseThreadOwnership(sId)
must be
called when exclusive access to the session is no longer required.
This method may only be called within the bounds of a call to
enter(sId)
and exit(sId)
.
sId
- the ID of the session to obtain ownership forprotected boolean releaseThreadOwnership(String sId)
This method may only be called within the bounds of a call to
enter(sId)
and exit(sId)
.
sId
- the ID of the session to release ownership ofprotected boolean isAllowLocalAttributes()
This feature is available only if the sticky session ownership option is on and is enforced if a distribution controller is specified.
protected boolean isEnableSuspectAttributes()
protected boolean isEnableAttributeListenerOptimization()
protected boolean isAssumeLocality()
public int getSessionIdLength()
public HttpSessionIdGenerator getSessionIdGenerator()
protected String generateSessionId()
protected abstract AbstractHttpSessionModel instantiateModel(javax.servlet.http.HttpSession session, String sId)
session
- the session that delegates to this modelsId
- the session IDprotected AbstractHttpSessionModel getOwnedModel(String sId)
sId
- the session IDIllegalStateException
- if the model does not exist, or it is
not owned by this threadprotected AbstractHttpSessionModel getModel(String sId, boolean fLite)
sId
- the session ID
* @param fLite when set to true then if a near cache is used, the front map is avoided;
thus avoiding listener registration and unnecessary eviction on the front mapprotected AbstractHttpSessionModel getModel(String sId)
sId
- the session IDprotected static void putBlind(Map map, Object oKey, Object oValue)
map
- the map to store the key/value pair intooKey
- the key to storeoValue
- the value to storeprotected static void removeBlind(Map map, Object oKey)
map
- the map to remove the key/value pair fromoKey
- the key to removeprotected static void removeAllBlind(Map map, Set<Object> colKeys)
map
- the map to remove the key/value pairs fromcolKeys
- the collection of keys which needs to be removedpublic void releaseCache(NamedCache cache)
cache
- a NamedCache instance to release (may be null)public int getAverageModelLifetime()
public int getAverageModelSize()
public int getMaxModelSize()
public int getMinModelSize()
public int getModelDeaths()
public int getModelUpdates()
public void resetStatistics()
protected void onModelUpdate(int cb)
cb
- the size (in bytes) of the session modelprotected void recordMapLocksState(String sKey, String sValue)
sKey
- key to record the mapLocks statesValue
- value of the recorded mapLocks state