Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.coherence.servlet
Class AbstractHttpSessionCollection

    java.lang.Object
      com.tangosol.util.Base
          com.tangosol.coherence.servlet.AbstractHttpSessionCollection

All Implemented Interfaces:
  HttpSessionCollection, XmlConfigurable

Direct Known Subclasses:
  MonolithicHttpSessionCollection, TraditionalHttpSessionCollection

    public abstract class AbstractHttpSessionCollection

extends Base
implements HttpSessionCollection, XmlConfigurable

An abstract base class from which implementations of HttpSessionCollection can be more easily built.

Version:
  Coherence 2.3
Author:
  cp 2003.10.14

Nested Class Summary
`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.ExitAgent` This agent is used to request the other servers in the cluster to unlock the specified session ID.
`static class` | `AbstractHttpSessionCollection.ExitObserver` This InvocationObserver waits for an ExitAgent to report back that some server in the cluster did have the specified session id locked.
`static class` | `AbstractHttpSessionCollection.ExitTask` This task is used to unlock a session ID.
`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.

Nested classes/interfaces inherited from interface com.tangosol.coherence.servlet.HttpSessionCollection
`HttpSessionCollection.AttributeScopeController, HttpSessionCollection.SessionDistributionController`

Field Summary
`static java.lang.String` | `CACHENAME_DEATHCERTS` The name of the clustered cache that stores the IDs of "recently departed" sessions.
`static java.lang.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 java.lang.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 java.lang.String` | `CACHENAME_SESSIONS` The name of the clustered cache that stores the sessions.
`static java.lang.String` | `CTX_INIT_ALLOW_LOCAL_ATTRIBUTES` The configuration property that specifies whether non-serializable attributes should be preserved as local.
`static java.lang.String` | `CTX_INIT_APPLICATION_NAME` The configuration property that specifies the name of the web application.
`static java.lang.String` | `CTX_INIT_CACHENAME_DEATHCERTS` The configuration property that overrides the name of the clustered cache that stores the IDs of "recently departed" sessions.
`static java.lang.String` | `CTX_INIT_CACHENAME_LOCAL_ATTRIBUTES` The configuration property that overrides the name of the local cache that stores non-distributed session attributes when the SessionDistributionController option is implemented.
`static java.lang.String` | `CTX_INIT_CACHENAME_LOCAL_SESSIONS` The configuration property that overrides the name of the local cache that stores non-distributed sessions when the SessionDistributionController option is implemented.
`static java.lang.String` | `CTX_INIT_CACHENAME_SESSIONS` The configuration property that overrides the name of the clustered cache that stores the sessions.
`static java.lang.String` | `CTX_INIT_DAEMON_ASSUME_LOCALITY` True to assume that the sessions in the cache are split across only the servers that are doing reaping.
`static java.lang.String` | `CTX_INIT_DIST_CONTROLLER_CLASS` The configuration property that specifies an implementation of the SessionDistributionController interface to use.
`static java.lang.String` | `CTX_INIT_SCOPE_CONTROLLER_CLASS` The configuration property that specifies an implementation of the AttributeScopeController interface to use.
`static java.lang.String` | `CTX_INIT_SERVICENAME_OWNERSHIP` The configuration property that specifies the name of the invocation service that will be used to manage sticky session ownership.
`static java.lang.String` | `CTX_INIT_SESSION_APP_LOCK` The configuration property that specifies application level session locking.
`static java.lang.String` | `CTX_INIT_SESSION_EXPIRE_SECS` The configuration property that overrides the session expirty time.
`static java.lang.String` | `CTX_INIT_SESSION_ID_LENGTH` The configuration property that overrides the session id length.
`static java.lang.String` | `CTX_INIT_SESSION_MEMBER_LOCK` The configuration property that specifies member level session locking.
`static java.lang.String` | `CTX_INIT_SESSION_STICKY` The configuration property that specifies whether sticky sessions optimizations will be used.
`static java.lang.String` | `CTX_INIT_SESSION_STRICT_SPEC` The configuration property that specifies strict spec adherence.
`static java.lang.String` | `CTX_INIT_SESSION_THREAD_LOCK` The configuration property that specifies thread level session locking.
`static java.lang.String` | `SERVICENAME_OWNERSHIP` The name of the clustered invocation service that manages sticky session ownership.

Constructor Summary
`AbstractHttpSessionCollection()` Default constructor (required).

Method Summary
`void` | `activate(java.lang.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.
`HttpSessionModel` | `create(javax.servlet.http.HttpSession session)` This method creates a new session, returning the session model for the new session.
`void` | `destroy(java.lang.String sId)` Destroy the specified session.
`protected void` | `destroyLocalAttributesCache(java.lang.String sId)` Destroy the cache of local-only session attributes for the specified session ID.
`protected java.util.Map` | `ensureLocalAttributesCache(java.lang.String sId)` Get the cache of local-only session attributes for the specified session ID.
`boolean` | `enter(java.lang.String sId, boolean fWait)` Obtain any necessary ownership for the specified session.
`void` | `exit(java.lang.String sId, boolean fFlush)` Release ownership for the specified session.
`protected java.lang.String` | `generateSessionId()` Generate a potential session ID.
`HttpSessionModel` | `get(java.lang.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.
`NamedCache` | `getClusterCache()` Get the cache of existent distributed session models.
`protected static AbstractHttpSessionCollection` | `getCollection()` Obtain the AbstractHttpSessionCollection that is being used in the current application.
`XmlElement` | `getConfig()` Determine the current configuration of the object.
`protected long` | `getCurrentTime()` Determine the current time value in milliseconds.
`NamedCache` | `getDeathCertCache()` Get the cache of previously used session IDs (IDs of previously existent HttpSessionModel objects).
`int` | `getDefaultMaxInactiveInterval()` Determine the default maximum interval, in seconds, that a session will be kept alive without any activity.
`protected java.lang.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 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.
`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(java.lang.String sId)` 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(java.lang.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.
`int` | `getSessionIdLength()` Determine the length that session IDs will be created with.
`protected java.lang.String` | `getSessionOwnershipInfo(java.lang.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, java.lang.String sId)` Factory Method: Instantiate a AbstractHttpSessionModel or subclass thereof.
`boolean` | `isActive(java.lang.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.
`boolean` | `isExistent(java.lang.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(java.lang.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.
`boolean` | `isStrict()` Determine if the Servlet specification is being followed strictly.
`protected boolean` | `isStuck(java.lang.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).
`java.util.Iterator` | `iterateIds()` Obtain an iterator of the session IDs.
`java.util.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.
`protected boolean` | `obtainAppOwnership(java.lang.String sId, boolean fWait)` Obtain application ownership for the specified session.
`protected boolean` | `obtainClusterOwnership(java.lang.String sId, boolean fWait)` Obtain ownership within the cluster for the specified session.
`protected boolean` | `obtainThreadOwnership(java.lang.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(java.lang.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(java.util.Map map, java.lang.Object oKey, java.lang.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` | `releaseAppOwnership(java.lang.String sId)` Release application ownership of the specified session.
`void` | `releaseCache(NamedCache cache)` Release the passed NamedCache instance.
`protected void` | `releaseClusterOwnership(java.lang.String sId)` Release ownership within the cluster of the specified session.
`protected boolean` | `releaseStuckSession(java.lang.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 void` | `releaseThreadOwnership(java.lang.String sId)` Release thread ownership of the specified session.
`protected static void` | `removeBlind(java.util.Map map, java.lang.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.
`void` | `resetStatistics()` Reset all statistics maintained by this session collection.
`void` | `setConfig(XmlElement xml)` Specify the configuration for the object.
`void` | `shutdown()` Notify the session collection that it is being shut down.
`java.lang.String` | `toString()` Returns a string representation of the object.

Field Detail

### CTX_INIT_APPLICATION_NAME

    public static final java.lang.String CTX_INIT_APPLICATION_NAME

  The configuration property that specifies the name of the web application.

  See Also:
    Constant Field Values

### CTX_INIT_CACHENAME_SESSIONS

    public static final java.lang.String CTX_INIT_CACHENAME_SESSIONS

  The configuration property that overrides the name of the clustered cache that stores the sessions.

  See Also:
    Constant Field Values

### CTX_INIT_CACHENAME_LOCAL_SESSIONS

    public static final java.lang.String CTX_INIT_CACHENAME_LOCAL_SESSIONS

  The configuration property that overrides the name of the local cache that stores non-distributed sessions when the SessionDistributionController option is implemented.

  See Also:
    Constant Field Values

### CTX_INIT_CACHENAME_LOCAL_ATTRIBUTES

    public static final java.lang.String CTX_INIT_CACHENAME_LOCAL_ATTRIBUTES

  The configuration property that overrides the name of the local cache that stores non-distributed session attributes when the SessionDistributionController option is implemented.

  See Also:
    Constant Field Values

### CTX_INIT_CACHENAME_DEATHCERTS

    public static final java.lang.String CTX_INIT_CACHENAME_DEATHCERTS

  The configuration property that overrides the name of the clustered cache that stores the IDs of "recently departed" sessions.

  See Also:
    Constant Field Values

### CTX_INIT_SESSION_EXPIRE_SECS

    public static final java.lang.String CTX_INIT_SESSION_EXPIRE_SECS

  The configuration property that overrides the session expirty time.

  See Also:
    Constant Field Values

### CTX_INIT_SESSION_ID_LENGTH

    public static final java.lang.String CTX_INIT_SESSION_ID_LENGTH

  The configuration property that overrides the session id length.

  See Also:
    Constant Field Values

### CTX_INIT_SESSION_MEMBER_LOCK

    public static final java.lang.String CTX_INIT_SESSION_MEMBER_LOCK

  The configuration property that specifies member level session locking.

  See Also:
    Constant Field Values

### CTX_INIT_SESSION_APP_LOCK

    public static final java.lang.String CTX_INIT_SESSION_APP_LOCK

  The configuration property that specifies application level session locking.

  See Also:
    Constant Field Values

### CTX_INIT_SESSION_THREAD_LOCK

    public static final java.lang.String CTX_INIT_SESSION_THREAD_LOCK

  The configuration property that specifies thread level session locking.

  See Also:
    Constant Field Values

### CTX_INIT_DAEMON_ASSUME_LOCALITY

    public static final java.lang.String CTX_INIT_DAEMON_ASSUME_LOCALITY

  True to assume that the sessions in the cache are split across only the servers that are doing reaping.

  See Also:
    Constant Field Values

### CTX_INIT_SESSION_STRICT_SPEC

    public static final java.lang.String CTX_INIT_SESSION_STRICT_SPEC

  The configuration property that specifies strict spec adherence.

  See Also:
    Constant Field Values

### CTX_INIT_DIST_CONTROLLER_CLASS

    public static final java.lang.String CTX_INIT_DIST_CONTROLLER_CLASS

  The configuration property that specifies an implementation of the SessionDistributionController interface to use.

  See Also:
    Constant Field Values

### CTX_INIT_SCOPE_CONTROLLER_CLASS

    public static final java.lang.String CTX_INIT_SCOPE_CONTROLLER_CLASS

  The configuration property that specifies an implementation of the AttributeScopeController interface to use.

  See Also:
    Constant Field Values

### CTX_INIT_SESSION_STICKY

    public static final java.lang.String CTX_INIT_SESSION_STICKY

  The configuration property that specifies whether sticky sessions optimizations will be used.

  See Also:
    Constant Field Values

### CTX_INIT_SERVICENAME_OWNERSHIP

    public static final java.lang.String CTX_INIT_SERVICENAME_OWNERSHIP

  The configuration property that specifies the name of the invocation service that will be used to manage sticky session ownership.

  See Also:
    Constant Field Values

### CTX_INIT_ALLOW_LOCAL_ATTRIBUTES

    public static final java.lang.String CTX_INIT_ALLOW_LOCAL_ATTRIBUTES

  The configuration property that specifies whether non-serializable attributes should be preserved as local.

  See Also:
    Constant Field Values

### CACHENAME_SESSIONS

    public static final java.lang.String CACHENAME_SESSIONS

  The name of the clustered cache that stores the sessions.

  See Also:
    Constant Field Values

### CACHENAME_LOCAL_SESSIONS

    public static final java.lang.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).

  See Also:
    Constant Field Values

### CACHENAME_LOCAL_ATTRIBUTES

    public static final java.lang.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).

  See Also:
    Constant Field Values

### CACHENAME_DEATHCERTS

    public static final java.lang.String CACHENAME_DEATHCERTS

  The name of the clustered cache that stores the IDs of "recently departed" sessions.

  See Also:
    Constant Field Values

### SERVICENAME_OWNERSHIP

    public static final java.lang.String SERVICENAME_OWNERSHIP

  The name of the clustered invocation service that manages sticky session ownership.

  See Also:
    Constant Field Values

Constructor Detail

### AbstractHttpSessionCollection

    public AbstractHttpSessionCollection()

  Default constructor (required).

Method Detail

### getCollection

    protected static AbstractHttpSessionCollection getCollection()

  Obtain the AbstractHttpSessionCollection that is being used in the current application. Because this class must be included as part of the application deployment, the singleton pattern should be applicable.

  Returns:
    the singleton instance of the AbstractHttpSessionCollection

### getConfig

    public XmlElement getConfig()

  Determine the current configuration of the object.

  Specified by:
    `getConfig` in interface `XmlConfigurable`
  Returns:
    the XML configuration or null

### setConfig

    public void setConfig(XmlElement xml)

  Specify the configuration for the object.

  Specified by:
    `setConfig` in interface `XmlConfigurable`
  Parameters:
    `xml` - the XML configuration for the object

### create

    public HttpSessionModel create(javax.servlet.http.HttpSession session)

  This method creates a new session, returning the session model for the new 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.

  Specified by:
    `create` in interface `HttpSessionCollection`
  Parameters:
    `session` - the HttpSession object to bind the session model to; used for issuing events; must not be null
  Returns:
    the HttpSessionModel object for the new session

### postCreate

    public void postCreate(javax.servlet.http.HttpSession session)

  This method is called at the end of the session creation process.

  When this method is called, the session state is exists, owned, active.

  Specified by:
    `postCreate` in interface `HttpSessionCollection`
  Parameters:
    `session` - the HttpSession object; must not be null

### isExistent

    public boolean isExistent(java.lang.String sId)

  Determine if the specified session ID identifies a session that exists.

  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.

  Specified by:
    `isExistent` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID to check for existence
  Returns:
    true if the session exists; false otherwise

### destroy

    public void destroy(java.lang.String sId)

  Destroy the specified session.

  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.

  Specified by:
    `destroy` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID; must not be null

### enter

    public boolean enter(java.lang.String sId,
                         boolean fWait)

  Obtain any necessary ownership for the specified session. Ownership requirements are expected to be declarative, so this method may be a no-op, or it may involve thread-level, application-level, or even cluster-wide locking.

  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.

  Specified by:
    `enter` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID; must not be null
    `fWait` - true if the thread should block until the session becomes available; false otherwise
  Returns:
    true if the session is now owned by the calling thread

### isOwned

    public boolean isOwned(java.lang.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)`.

  Specified by:
    `isOwned` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID; must not be null
  Returns:
    true if the session is owned; false otherwise.

### exit

    public void exit(java.lang.String sId,
                     boolean fFlush)

  Release ownership for the specified session. This method must be called exactly once for each call to `enter(sId)`, with the only exceptions being:
  - If the session no longer exists, exit should not be called.
  - If the session was created as part of the HTTP request processing, this method must be invoked even though the corresponding `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.

  Specified by:
    `exit` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID; must not be null
    `fFlush` - 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 flush

### activate

    public void activate(java.lang.String sId,
                         javax.servlet.http.HttpSession session)

  Move the session into an active state, if it is not already. The active state is defined as the state in which the session is considered to be "live" in a particular JVM. This primarily relates to the optional event interfce (HttpSessionActivationListener) that session attributes can implement to find out when the session is passivated and activated.

  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.

  Specified by:
    `activate` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID; must not be null
    `session` - the HttpSession object to bind the session model to; used for issuing events; must not be null

### isActive

    public boolean isActive(java.lang.String sId)

  Determine if the specified session ID identifies a session that is in the active state.

  This method may only be called within the bounds of a call to `enter(sId)` and `exit(sId)`.

  Specified by:
    `isActive` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID to check for the active state
  Returns:
    true if the session exists and is active; false otherwise

### passivate

    public void passivate(java.lang.String sId)

  Move the session into a passive state, if it is not already.

  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.

  Specified by:
    `passivate` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID; must not be null

### iterateIds

    public java.util.Iterator iterateIds()

  Obtain an iterator of the session IDs.

  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.

  Specified by:
    `iterateIds` in interface `HttpSessionCollection`
  Returns:
    an iterator that iterates over all String session IDs

### iteratePotentiallyExpiredIds

    public java.util.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.

  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.

  Specified by:
    `iteratePotentiallyExpiredIds` in interface `HttpSessionCollection`
  Returns:
    an iterator that iterates over the session IDs that this JVM is responsible for periodically checking for expiry

### get

    public HttpSessionModel get(java.lang.String sId)

  Obtain the HttpSessionModel for the specified session, or null if it does not exist.

  This method may only be called within the bounds of a call to `enter(sId)` and `exit(sId)`.

  Specified by:
    `get` in interface `HttpSessionCollection`
  Parameters:
    `sId` - the session ID; must not be null
  Returns:
    the HttpSessionModel for the requested session or null

### addHttpSessionListener

    public void addHttpSessionListener(javax.servlet.http.HttpSessionListener listener)

  Sign up the specified listener to receive HttpSessionEvent objects.

  Specified by:
    `addHttpSessionListener` in interface `HttpSessionCollection`
  Parameters:
    `listener` - the HttpSessionListener to sign up for events

### removeHttpSessionListener

    public void removeHttpSessionListener(javax.servlet.http.HttpSessionListener listener)

  Sign off the specified listener so it no longer will receive HttpSessionEvent objects.

  Specified by:
    `removeHttpSessionListener` in interface `HttpSessionCollection`
  Parameters:
    `listener` - the HttpSessionListener that was previously signed up for events

### addHttpSessionAttributeListener

    public void addHttpSessionAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)

  Sign up the specified listener to receive HttpSessionBindingEvent objects.

  Specified by:
    `addHttpSessionAttributeListener` in interface `HttpSessionCollection`
  Parameters:
    `listener` - the HttpSessionAttributeListener to sign up for events

### removeHttpSessionAttributeListener

    public void removeHttpSessionAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)

  Sign off the specified listener so it no longer will receive HttpSessionBindingEvent objects.

  Specified by:
    `removeHttpSessionAttributeListener` in interface `HttpSessionCollection`
  Parameters:
    `listener` - the HttpSessionAttributeListener that was previously signed up for events

### shutdown

    public void shutdown()

  Notify the session collection that it is being shut down. After this method invocation has been made, the session collection may throw IllegalStateException for any subsequent method invocation made to it.

  Specified by:
    `shutdown` in interface `HttpSessionCollection`

### toString

    public java.lang.String toString()

  Returns a string representation of the object.

  Returns:
    a string representation of the object

### getHttpSessionListeners

    protected Listeners getHttpSessionListeners()

  Determine the list of listeners that are registered for session life cycle events.

  Returns:
    the non-null Listeners object containing zero or more HttpSessionListeners

### getHttpSessionAttributeListeners

    protected Listeners getHttpSessionAttributeListeners()

  Determine the list of listeners that are registered for session attribute modification events.

  Returns:
    the non-null Listeners object containing zero or more HttpSessionAttributeListeners

### isStrict

    public boolean isStrict()

  Determine if the Servlet specification is being followed strictly.

  Returns:
    true if the Servlet specification is being followed strictly

### getDefaultMaxInactiveInterval

    public int getDefaultMaxInactiveInterval()

  Determine the default maximum interval, in seconds, that a session will be kept alive without any activity.

  Returns:
    the default number of seconds to keep an inactive session

### isMemberLockingEnforced

    protected boolean isMemberLockingEnforced()

  Determine whether or not two or more JVMs should be prevented from accessing the same session simultaneously.

  Returns:
    true to limit the access to a session to one JVM at a time

### isAppLockingEnforced

    protected boolean isAppLockingEnforced()

  Determine whether or not two or more applications should be prevented from accessing the same session simultaneously.

  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.

  Returns:
    true to limit the access to a session to one application at a time

### isThreadLockingEnforced

    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).

  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.

  Returns:
    true to limit the access to a session to one thread at a time

### getCurrentTime

    protected long getCurrentTime()

  Determine the current time value in milliseconds.

  Returns:
    the current time value in milliseconds

### getDescription

    protected java.lang.String getDescription()

  Returns a string representation of this object's attributes.

  Returns:
    a string representation of this object's attributes

### getStickyCache

    public NamedCache getStickyCache()

  Get the cache of information about sessions that are stuck to this member, if sticky ownership is used.

  Returns:
    a cache mapping from session id to sticky status (either Boolean.TRUE to indicate stuck or Boolean.FALSE to indicate that it is stuck but that it has been marked for release)

### getStickyExitTaskCache

    public NamedCache getStickyExitTaskCache()

  Get the cache of session ExitTasks for sessions that are stuck to this member, if sticky ownership is used.

  Returns:
    a cache mapping from session id to ExitTask that can be used to exit (thus unstick) the corresponding session

### getStickyService

    protected InvocationService getStickyService()

  Get the invocation service to use to manage sticky session ownership.

  Returns:
    the invocation service to use to manage sticky session ownership

### getAppControlCache

    protected NamedCache getAppControlCache()

  Get the cache used to control concurrent access to a session by multiple applications, if application locking is used.

  Returns:
    a cache mapping from session id to application ownership information (an object array of size two, with the first element being the owning HttpSessionCollection and the second element being an Integer reference count)

### getActiveCache

    protected NamedCache getActiveCache()

  Get the cache of active sessions.

  Returns:
    a cache of active sessions; the cache maps from session ID to HttpSession objects

### getOwnedCache

    protected NamedCache getOwnedCache()

  Get the cache of owned ("locally live") session models. The concept of "locally live" is internal to this collection implementation, and is not part of the collection/model design itself. A model is considered "locally live" if it is existent and has been entered, until the point that it is fully exited or destroyed.

  Returns:
    a cache of owned session models; the cache maps from session ID to HttpSessionModel objects

### getClusterCache

    public NamedCache getClusterCache()

  Get the cache of existent distributed session models.

  Returns:
    a cache that maps from session ID to HttpSessionModel objects

### getDistributionController

    protected HttpSessionCollection.SessionDistributionController getDistributionController()

  Get the SessionDistributionController for the session collection, if one was specified.

  Returns:
    the controller object, or null if none was specified

### getScopeController

    protected HttpSessionCollection.AttributeScopeController getScopeController()

  Get the AttributeScopeController for the session collection, if one was specified.

  Returns:
    the controller object, or null if none was specified

### getLocalCache

    public NamedCache getLocalCache()

  Get the cache of existent local-only session models.

  Returns:
    a cache that maps from session ID to HttpSessionModel objects

### getLocalAttributesCache

    public NamedCache getLocalAttributesCache()

  Get the cache of local-only session attributes.

  Returns:
    a cache that maps from session ID and attribute name to AttributeHolder objects

### ensureLocalAttributesCache

    protected java.util.Map ensureLocalAttributesCache(java.lang.String sId)

  Get the cache of local-only session attributes for the specified session ID.

  Parameters:
    `sId` - the session ID
  Returns:
    a cache that maps attribute name to AttributeHolder objects

### destroyLocalAttributesCache

    protected void destroyLocalAttributesCache(java.lang.String sId)

  Destroy the cache of local-only session attributes for the specified session ID.

  Parameters:
    `sId` - the session ID

### getDeathCertCache

    public NamedCache getDeathCertCache()

  Get the cache of previously used session IDs (IDs of previously existent HttpSessionModel objects).

  Returns:
    a cache that maps from session ID to a Long object containing the date/time that the session was destroyed

### isOwnershipSticky

    public boolean isOwnershipSticky()

  Determine if the sticky session ownership option is on.

  This is available only if an Enterprise Edition or Grid Edition license is available.

  Returns:
    true iff the sticky session ownership option is on

### isStuck

    protected boolean isStuck(java.lang.String sId)

  Determine if the specified session is stuck.

  Parameters:
    `sId` - the session id
  Returns:
    true iff the specified session is stuck

### getSessionOwnershipInfo

    protected java.lang.String getSessionOwnershipInfo(java.lang.String sId)

  Determine which cluster member (if any) holds the lock for the given session ID.

  Parameters:
    `sId` - the session ID
  Returns:
    a description of the member that holds the lock for the given session ID

### obtainClusterOwnership

    protected boolean obtainClusterOwnership(java.lang.String sId,
                                             boolean fWait)

  Obtain ownership within the cluster for the specified session.

  This method assumes that the owned cache is locked for the passed session id.

  Parameters:
    `sId` - the id of the session to obtain ownership for
    `fWait` - true to wait for the session to become available, false to give up immediately if ownership of the session is currently unavailable
  Returns:
    true on successfully obtaining ownership, false otherwise

### releaseClusterOwnership

    protected void releaseClusterOwnership(java.lang.String sId)

  Release ownership within the cluster of the specified session.

  This method assumes that the owned cache is locked for the passed session ID.

  Parameters:
    `sId` - the ID of the session to release ownership of

### releaseStuckSession

    protected boolean releaseStuckSession(java.lang.String sId,
                                          boolean fWait)

  Determine if the specified session is stuck, and if it is, to release it (or mark it to be released). This method is only designed to be called from an invocation agent.

  Parameters:
    `sId` - the session id to unstick if it's stuck here
    `fWait` - 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 unavailable
  Returns:
    true if the session is/was stuck here and is now released or is marked to be released

### obtainAppOwnership

    protected boolean obtainAppOwnership(java.lang.String sId,
                                         boolean fWait)

  Obtain application ownership for the specified session.

  This method assumes that the owned cache is locked for the passed session ID.

  Parameters:
    `sId` - the ID of the session to obtain ownership for
    `fWait` - true to wait for the session to become available, false to give up immediately if ownership of the session is currently unavailable
  Returns:
    true on successfully obtaining ownership, false otherwise

### releaseAppOwnership

    protected void releaseAppOwnership(java.lang.String sId)

  Release application ownership of the specified session.

  This method assumes that the owned cache is locked and cluster ownership has been obtained for the passed session ID.

  Parameters:
    `sId` - the ID of the session to release ownership of

### obtainThreadOwnership

    protected boolean obtainThreadOwnership(java.lang.String sId)

  Obtain thread ownership of the specified session, if necessary.

  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)`.

  Parameters:
    `sId` - the ID of the session to obtain ownership for
  Returns:
    true if the given ID was locked in the local owned cache; false otherwise

### releaseThreadOwnership

    protected void releaseThreadOwnership(java.lang.String sId)

  Release thread ownership of the specified session.

  This method may only be called within the bounds of a call to `enter(sId)` and `exit(sId)`.

  Parameters:
    `sId` - the ID of the session to release ownership of

### isAllowLocalAttributes

    protected boolean isAllowLocalAttributes()

  Determine if non-serializable attributes should be preserved as local.

  This feature is available only if the sticky session ownership option is on and is enforced if a distribution controller is specified.

  Returns:
    true iff non-serializable attributes should be preserved

### isAssumeLocality

    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.

  Returns:
    return true if and only if each existent session is managed on a server that is doing reaping

### generateSessionId

    protected java.lang.String generateSessionId()

  Generate a potential session ID. The returned id may be in use already.

  Returns:
    a seemingly random session id

### getSessionIdLength

    public int getSessionIdLength()

  Determine the length that session IDs will be created with.

  Returns:
    the length, in characters, for session IDs

### instantiateModel

    protected abstract AbstractHttpSessionModel instantiateModel(javax.servlet.http.HttpSession session,
                                                                 java.lang.String sId)

  Factory Method: Instantiate a AbstractHttpSessionModel or subclass thereof.

  Parameters:
    `session` - the session that delegates to this model
    `sId` - the session ID
  Returns:
    a new instance of AbstractHttpSessionModel or subclass thereof

### getOwnedModel

    protected AbstractHttpSessionModel getOwnedModel(java.lang.String sId)

  Obtain the specified session model that this thread owns, otherwise throw an exception.

  Parameters:
    `sId` - the session ID
  Returns:
    the specified model if it exists and this thread owns it
  Throws:
    `java.lang.IllegalStateException` - if the model does not exist, or it is not owned by this thread

### getModel

    protected AbstractHttpSessionModel getModel(java.lang.String sId)

  Obtain the specified session model.

  Parameters:
    `sId` - the session ID
  Returns:
    the specified model if it exists, null otherwise

### putBlind

    protected static void putBlind(java.util.Map map,
                                   java.lang.Object oKey,
                                   java.lang.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.

  Parameters:
    `map` - the map to store the key/value pair into
    `oKey` - the key to store
    `oValue` - the value to store

### removeBlind

    protected static void removeBlind(java.util.Map map,
                                      java.lang.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.

  Parameters:
    `map` - the map to remove the key/value pair from
    `oKey` - the key to remove

### releaseCache

    public void releaseCache(NamedCache cache)

  Release the passed NamedCache instance.

  Parameters:
    `cache` - a NamedCache instance to release (may be null)

### getAverageModelLifetime

    public 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.

  Returns:
    the average model lifetime (in seconds)

### getAverageModelSize

    public 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.

  Returns:
    the average model size (in bytes)

### getMaxModelSize

    public 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.

  Returns:
    the maximum model size (in bytes)

### getMinModelSize

    public 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.

  Returns:
    the minimum model size (in bytes)

### getModelDeaths

    public 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.

  Returns:
    the number of invalidated session models

### getModelUpdates

    public int getModelUpdates()

  Return the number of updates to session model objects since the last time statistics were reset.

  Returns:
    the number of updates to the session storage cache

### resetStatistics

    public void resetStatistics()

  Reset all statistics maintained by this session collection.

### onModelUpdate

    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.

  Parameters:
    `cb` - the size (in bytes) of the session model

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.