|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.jbo.common.ampool.SessionCookieImpl | +--oracle.jbo.http.HttpSessionCookieImpl | +--oracle.jbo.http.SharedSessionCookieImpl
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:
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.
Fields inherited from interface oracle.jbo.common.ampool.SessionCookie |
NULL_PASSIVATION_ID |
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 |
Type | Method |
---|---|
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. |
void |
timeout()
Internal use only. |
ApplicationModule |
useApplicationModule(boolean lock,
long waitTimeout)
Returns an application module instance for the current thread. |
Methods inherited from class oracle.jbo.http.HttpSessionCookieImpl |
readValue, timeout, valueBound,
valueUnbound, writeValue |
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, getEnvironment, getLastUpdate,
getPassivationId, getPoolSignature, getReservedPassivationId,
getSessionId, getSyncLock, getUserData,
getValue, hashCode, isActivationRequired,
isConnectionPoolingEnabled, isResetNonTransactionalState, reservePassivationId,
resetState, setActivationRequired, setEnvInfoProvider,
setEnvironment, setPassivationId, setReservedPassivationId,
setSessionCookieListener, toString |
Methods inherited from interface oracle.jbo.common.ampool.ApplicationModuleRef |
isApplicationModuleReserved, releaseApplicationModule,
useApplicationModule, useApplicationModule |
Constructor Detail |
public SharedSessionCookieImpl(java.lang.String applicationId, java.lang.String sessionId, ApplicationPool pool)
Method Detail |
public ApplicationModule useApplicationModule(boolean lock, long waitTimeout)
ApplicationModuleRef
If the application session cookie references application state the application state should be activated in the returned application module.
The lock parameter may be specified to acquire a lock for the shared application module resource. If a lock is acquired the application should be careful to release that lock after it is done using the application module resource. Application thread starvation may occur if the lock is held indefinitely.
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.
Best practice would be to invoke ApplicationModuleRef.useApplicationModule(boolean)
in a try...finally block that invokes
during finally.
useApplicationModule
in class SessionCookieImpl
oracle.jbo.common.ampool.ApplicationModuleRef
lock
- specify whether a session lock should be acquired for the
shared application module resourcewaitTimeout
- specifies the amount of time in milliseconds that the
thread should wait for the session cookie lockpublic void releaseApplicationModule(boolean checkin, boolean manageState, long waitTimeout)
ApplicationModuleRef
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
releaseApplicationModule
in class SessionCookieImpl
oracle.jbo.common.ampool.ApplicationModuleRef
checkin
- manageState
- manage the session application state between requestswaitTimeout
- specifies the amount of time in milliseconds that the
thread should wait for the session cookie lockpublic void timeout()
SessionCookieImpl
timeout
in class SessionCookieImpl
public boolean isFailoverEnabled()
SessionCookie
Session cookie developers should be careful that this value not change after a session cookie has become active.
isFailoverEnabled
in class HttpSessionCookieImpl
|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |