Business Components

oracle.jbo.http
Class SharedSessionCookieImpl

java.lang.Object
  |
  +--oracle.jbo.common.ampool.SessionCookieImpl
        |
        +--oracle.jbo.http.HttpSessionCookieImpl
              |
              +--oracle.jbo.http.SharedSessionCookieImpl
All Implemented Interfaces:
ApplicationModuleHandle, ApplicationModuleRef, oracle.jbo.http.BindingListener, HttpSessionCookie, java.io.Serializable, SessionCookie

public class SharedSessionCookieImpl
extends HttpSessionCookieImpl

A shared application module handle.

Some enterprise applications may define static data that is required across sessions and does not change very frequently. An example of this type of data might be application metadata that is used to render the application UI. If BC4J is used to access the static data then an unnecessary overhead is incurred if the static data caches are repopulated from the database for each application session on every request. In order to optimize performance common practice is to cache the shared static data for reuse across sessions and requests.

This class supports shared, static data caches by allowing requests from multiple sessions to share a single application module instance which is managed by an application pool for the lifetime of the web server VM. The SharedSessionCookieImpl extends the HttpSessionCookieImpl with the following logic for managing access to a shared application module instance:

  • Prevents unnecessary state passivation at the end of a request
  • Manages shared, transactional application module state across sessions and requests
  • The SharedSessionCookieFactory may be used to instantiate SharedSessionCookieImpl sessions for an application pool. The application developer may use the SharedSessionCookieImpl with an application pool by specifying the following BC4J property in the configuration of the application module that will be used to cache static data:

    jbo.ampool.sessioncookiefactoryclass=oracle.jbo.http.SharedSessionCookieFactory

    After having declared the property above the application developer may access the shared application module instance with any application pooling client like the BC4J data tags and the BC4J data web beans.

    Finally, the application developer should be careful about mutating the shared transactional state after a shared session cookie has been used. Most shared state should be "built and cached" only once after an application module is created or connected and before it has become available for use. This is important because the application pool may destroy application module instances during the lifetime of the pool in order to provide 24x7 availability.

    Please see HttpSessionCookieImpl for more infomartion regarding the http session cookie implementation.

    See Also:
    Serialized Form

    Fields inherited from interface oracle.jbo.common.ampool.SessionCookie
    NULL_PASSIVATION_ID, SHARED, STATE_MANAGED, STATE_UNMANAGED, UNSHARED
     
    Constructor Summary
    SharedSessionCookieImpl(java.lang.String applicationId, java.lang.String sessionId, ApplicationPool pool)
              This constructor may be used if the sessionId is already known.
     
    Method Summary
    TypeMethod
     boolean isFailoverEnabled()
              Indicates that session application module state should be persisted to secondary storage immediately upon a managed release.
     void releaseApplicationModule(boolean checkin, boolean manageState, long waitTimeout)
              Release an application module for reuse.
     
    Methods inherited from class oracle.jbo.http.HttpSessionCookieImpl
    readValue, timeout, valueBound, valueUnbound, writeValue
     
    Methods inherited from class oracle.jbo.common.ampool.SessionCookieImpl
    copyInto, equals, getApplicationId, getClientEnvironment, getClientEnvironment, getEnvInfoProvider, getEnvironment, getEnvironment, getLastUpdate, getPassivationId, getPoolSignature, getProperty, getReservedPassivationId, getSessionId, getSSOSubscriber, getSSOUserName, getSyncLock, getThreadRefCount, getUserData, getValue, hashCode, isActivationRequired, isActivationRequired, isApplicationModuleReserved, isConnectionPoolingEnabled, isResetNonTransactionalState, parsePassivationId, parseSessionId, releaseApplicationModule, reservePassivationId, reservePassivationId, resetState, resetStateInternal, setActivationRequired, setEnvInfoProvider, setEnvironment, setEnvironment, setPassivationId, setReservedPassivationId, setSessionCookieListener, setSingleThreaded, timeout, toString, useApplicationModule, useApplicationModule, useApplicationModule
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
     
    Methods inherited from interface oracle.jbo.common.ampool.SessionCookie
    copyInto, equals, getApplicationId, getEnvInfoProvider, getLastUpdate, getPassivationId, getPoolSignature, getReservedPassivationId, getSessionId, getSSOSubscriber, getSSOUserName, getSyncLock, getThreadRefCount, getValue, hashCode, isActivationRequired, isActivationRequired, isConnectionPoolingEnabled, isResetNonTransactionalState, reservePassivationId, reservePassivationId, resetStateInternal, setActivationRequired, setEnvInfoProvider, setEnvironment, setEnvironment, setPassivationId, setReservedPassivationId, setSessionCookieListener, toString
     
    Methods inherited from interface oracle.jbo.common.ampool.ApplicationModuleRef
    isApplicationModuleReserved, releaseApplicationModule, resetState, useApplicationModule, useApplicationModule, useApplicationModule
     
    Methods inherited from interface oracle.jbo.ApplicationModuleHandle
    getClientEnvironment, getClientEnvironment, getEnvironment, getEnvironment, getUserData
     

    Constructor Detail

    SharedSessionCookieImpl

    public SharedSessionCookieImpl(java.lang.String applicationId,
                                   java.lang.String sessionId,
                                   ApplicationPool pool)
    This constructor may be used if the sessionId is already known.
    Method Detail

    releaseApplicationModule

    public void releaseApplicationModule(boolean checkin,
                                         boolean manageState,
                                         long waitTimeout)
    Description copied from interface: ApplicationModuleRef
    Release an application module for reuse.

    This method should be invoked at the end of each session request.

    If another thread is holding the lock associated with the session cookie then the current thread will wait for the period specified by the waitTimeout parameter. The current thread may be blocked upon invoking releaseApplicationModule if it did not acquire a session cookie lock when it dereferenced the application module with #useApplicationModule(boolean).

    The checkin parameter may be used to indicate that the session application module instance should be checked in for reuse by other sessions.

    The manageState parameter may be used to indicate that the session application state should be managed between requests by the pooling framework.

    I

    Overrides:
    releaseApplicationModule in class SessionCookieImpl
    Following copied from interface: oracle.jbo.common.ampool.ApplicationModuleRef
    Parameters:
    checkin - SHARED or UNSHARED
    manageState - STATE_MANAGED or STATE_UNMANAGED
    waitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lock

    isFailoverEnabled

    public boolean isFailoverEnabled()
    Description copied from interface: SessionCookie
    Indicates that session application module state should be persisted to secondary storage immediately upon a managed release.

    Session cookie developers should be careful that this value not change after a session cookie has become active.

    Overrides:
    isFailoverEnabled in class HttpSessionCookieImpl

    Business Components