|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.jbo.pool.ResourcePool oracle.jbo.common.ampool.ApplicationPoolImpl
This class provides the default implementation of the ApplicationPool interface. A few notes about the locking strategy that has been employed to synchronize access to the shared application module resources in this pool. These notes are provided for the benefit of the application pool developer. They are not required to use the application pool.
The pool utilizes a singleton internal monitor object instance to synchronize read/write access to shared data.
In order to provide high pool availability, only those critical blocks that read/write from the shared data structures have been synchronized. Expensive application module operations like connect/disconnect, activiate/passivate, and rollback are performed outside of the pool lock. In order for this to work the application module is made not available inside of the pool lock before its state is modified. Using this strategy will prevent other sessions from attempting to recycle the application module instance while its state is not consistent.
This strategy of course assumes that application module access from the same session is properly synchronized. Consider the following scenario:
1. Request thread one from session one acquires a pool lock. While holding the lock the request sets the session application module as not available. Request thread one from session one then releases the pool lock and begins modifying the application module state.
2. Request thread two from session one comes along. Before the application module state has been modified by thread one above, request thread two invokes useApplicationModule. Request thread two acquires a pool lock and finds the application module instance associated with the request session (even though the application module is not available). Request thread two happily continues using the application module reference and a possible race condition between request threads one and two has occured.
In order to prevent this scenario, the pool assumes that session cookie access is also properly synchronized. This is indeed the case for the provided implementations of oracle.jbo.common.ampool.SessionCookie.
The discussion above introduces two levels of locking, session locking and pool locking. The pool's locking strategy utilizes the following rules to prevent deadlock:
1. Session locks are never acquired while pool locks are held. Please note that this rule does allow a pool lock to be acquired while a session lock is held. In fact, the pool depends upon this to prevent the race conditions mentioned above.
From an availability standpoint this rule makes sense since the rule implies that pool locks will be held for shorter duration then a session lock. However, because of the two levels of locking the application pool developer must be constantly aware of the potential for deadlock when implementing pool logic. To further understand the above rule consider the following scenario:
1. Request 1 for session 1 has acquired a pool lock without first acquiring a session lock. In the critical section the request updates some shared session state that requires a session lock to be acquired.
2. Concurrently, request 2 for session 1 acquires a session lock. In the critical section the request requires access to some shared application pool state that requires an application pool lock to be acquired.
Obviously, in the scenario above request one may be blocked waiting for the session lock that is held by request two and request two may be blocked waiting for the pool lock that is held by request one; the definition of deadlock.
Most pool methods should be accessed using a session cookie, so that the rule defined above holds true. However, there are some instances where a cookie lock could be acquired after a pool lock has been acquired:
1. When a request from session one recycles an application module that is referenced by session two. If the session two state must be passivated then the request thread from session one must update the passivation id of the session two cookie. This requires the request thread from session one to acquire a session lock for session two. It is safe to assume that a session lock for the session one has already been acquired because request one is an active request that must have accessed the pool using the session cookie API. It is not safe to assume that a session lock for session two has been acquired because the current pool request thread did not originate from session two. Attempting to acquire a session lock for session two while holding a pool lock may cause the deadlock mentioned above. This scenario is avoided by executing the section that requires the session lock for session two after the pool lock has been released.
2. When a referenced application module is removed by the high water mark functionality. This scenario is very similar to the one described in item one above. However, instead of the request thread from session one recycling an application module that is referenced by session two the request thread from session one is discarding the application module that is referenced by session two.
View definition of ApplicationPool
View Implementation of ApplicationPoolImpl
Field Summary | |
static int |
CREATION_POLICY_ROUND_ROBIN
|
static int |
CREATION_POLICY_SERIAL
|
static int |
MAX_HANDLE_POLICY_ERROR
|
static int |
MAX_HANDLE_POLICY_SPILL
|
Fields inherited from class oracle.jbo.pool.ResourcePool |
MAX_WAIT_TIME, mLock, mLogger, WAIT_TIME_INCREMENT |
Constructor Summary | |
ApplicationPoolImpl()
Constructor |
Method Summary | |
void |
addSessionCookie(SessionCookie cookie)
Add an existing session cookie to the pool. |
void |
checkin(ApplicationModule appModule)
Deprecated. Replaced by: SessionCookie.releaseApplicationModule(int) .
Application developers should invoke:
SessionCookie.releaseApplicationModule(SessionCookie.SHARED_UNMANAGED_RELEASE_MODE)
instead of this method. A session cookie instance may be acquired by
invoking:
This change was necessary to support the SessionCookie interface. Please
see:
|
java.lang.String |
checkinWithSessionState(ApplicationModule appModule)
Deprecated. Replaced by: SessionCookie.releaseApplicationModule(boolean, boolean) .
Application developers should invoke: SessionCookie.releaseApplicationModule(true, true)
instead of this method. A session cookie instance may be acquired by
invoking:
This change was necessary to support the SessionCookie interface. Please
see:
for more information about using SessionCookies with the application pool. |
ApplicationModule |
checkout()
Deprecated. Replaced by: ApplicationModuleRef.useApplicationModule() .
Application developers should invoke: SessionCookie.useApplicationModule()
instead of this method. A session cookie instance may be acquired by
invoking:
This change was necessary to support the SessionCookie interface. Please
see:
|
ApplicationModule |
checkout(java.lang.String cookieValue)
Deprecated. Replaced by: ApplicationModuleRef.useApplicationModule() .
Application developers should invoke: SessionCookie.useApplicationModule()
instead of this method. A session cookie instance may be acquired by
invoking:
This change was necessary to support the SessionCookie interface. Please
see:
for more information about using SessionCookies with the application pool. |
void |
commitAndSyncCache(ApplicationModule instance)
Given an intitial Application Module instance, synchronizes the caches of all Application Module instances in the pool. |
protected boolean |
compareConnectionMetadata(ConnectionMetadata oldConnectionMetadata,
ConnectionMetadata newConnectionMetadata)
Invoked by the application pool implementation when an application module instance is recycled for use by a session different than the session that had previously used that instance. |
protected void |
connect(ApplicationModule appModule,
java.util.Hashtable environment)
Deprecated. Replaced by oracle.jbo.common.ampool.ConnectionStrategy#connect(ApplicationModule, SessionCookie) .
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends DefaultConnectionStrategy . |
ApplicationModule |
createNewInstance()
Deprecated. Replaced by ConnectionStrategy.createApplicationModule(SessionCookie, EnvInfoProvider) .
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends:
DefaultConnectionStrategy .
|
protected oracle.jbo.pool.ResourcePoolLogger |
createPoolLogger()
|
SessionCookie |
createSessionCookie(java.lang.String applicationId,
java.lang.String sessionId,
java.util.Properties properties)
Create a session cookie for access to this pool. |
protected void |
disconnect(ApplicationModule appModule,
boolean retainState,
java.util.Hashtable environment)
Deprecated. Replaced by ConnectionStrategy.disconnect(ApplicationModule, boolean, SessionCookie) .
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends DefaultConnectionStrategy . |
protected void |
finalizeResource(java.lang.Object resource,
java.lang.Object details)
|
java.lang.String |
getApplicationModuleClass()
Return the class name of the application modules being managed by the pool. |
int |
getAvailableInstanceCount()
Returns the available number of instances in the Application Pool. |
int |
getAvailableNumPools()
Deprecated. Replaced by getAvailableInstanceCount() |
ConnectionStrategy |
getConnectionStrategy()
Get the application module strategy that will be used to create, connect, disconnect, and reconnect the application module. |
protected java.lang.String |
getConnectionStrategyClassName()
|
java.lang.String |
getConnectString()
Deprecated. This value should be passed to the pool connection strategy as SessionCookie environment or by implementing an EnvInfoProvider. The value may be acquired from the ApplicationPool or SessionCookie environment by using the ConnectionStrategy.DB_CONNECT_STRING_PROPERTY key. |
long |
getCreationTimeMillis(ApplicationModule appModule)
Gets the time when the app module was created (in milli-secs). |
java.lang.String |
getEnvConfigurationName()
Return the name of the BC4J configuration that was used to initialize the pool environment. |
java.util.Hashtable |
getEnvironment()
Returns the Hashtable that was used to initialize the Context for the application module instances. |
int |
getInitPoolSize()
Get the initial number of application module instances which will be instantiated in the application pool. |
ApplicationModule |
getInstance(int index)
|
int |
getInstanceCount()
Returns the number of instances that the Application Pool has created. |
protected int |
getMaxAvailableSize()
|
protected int |
getMaxInactiveAge()
|
int |
getMaxPoolSize()
Get the maximum number of application module instances which may be referenced by the application pool. |
protected long |
getMaxWaitTime()
Determines how long a request should wait for an available application module instance when the maximum pool size has been reached. |
protected int |
getMinAvailableSize()
|
java.lang.String |
getName()
Returns the pool's name. |
java.lang.String |
getPassword()
Deprecated. This value should be passed to the pool connection strategy as SessionCookie environment or by implementing an EnvInfoProvider. The value may be acquired from the ApplicationPool or SessionCookie environment by using the Configuration.DB_PASSWORD_PROPERTY key. |
java.lang.String |
getPoolName()
Deprecated. Replaced by getName() . |
protected int |
getRecycleThreshold()
|
protected java.lang.Object |
getResourceDetails(java.lang.Object resource)
|
protected java.lang.Object |
getResourcePoolKey()
|
SessionCookieFactory |
getSessionCookieFactory()
Get the factory that will be used to create new session cookie instances. |
protected java.lang.String |
getSessionCookieFactoryClassName()
|
long |
getSignature()
Return a signature for the application pool. |
Statistics |
getStatistics()
Returns the pool statistics. |
long |
getTimeCreated()
|
long |
getTimeToCreateMillis(ApplicationModule appModule)
Gets the time that it will tke to create the application module (in milli-secs). |
protected int |
getTimeToLive()
|
java.util.Hashtable |
getUserData()
Returns the User Data hashtable. |
java.lang.String |
getUserName()
Deprecated. This value should be passed to the pool connection strategy as SessionCookie environment or by implementing an EnvInfoProvider. The value may be acquired from the ApplicationPool or SessionCookie environment by using the Configuration.DB_USERNAME_PROPERTY key. |
void |
initialize()
|
void |
initialize(java.lang.String name,
java.lang.String applicationModuleClassName,
java.lang.String connectString,
java.util.Hashtable env)
This initializes the ApplicationPool. |
java.lang.Object |
instantiateResource(java.util.Properties properties)
|
boolean |
isAMPoolingEnabled()
|
boolean |
isAvailable(ApplicationModule appModule)
Deprecated. Implementation detail. This method has been made protected. |
protected boolean |
isDoConnectionPooling()
Deprecated. This property is specific to the SessionCookie. Extending logic should be migrated to a custom extension of: SessionCookieImpl.isConnectionPoolingEnabled()
|
protected boolean |
isDoFailover()
Deprecated. This property is specific to the SessionCookie. Extending logic should be migrated to a custom extension of: SessionCookieImpl.isFailoverEnabled()
|
boolean |
isDynamicJDBCCredentials()
|
protected boolean |
isInstanceAlive(ApplicationModule instance)
Performs tests to determine if the application module instance is still alive. |
boolean |
isUseExclusive()
|
protected void |
notifyApplicationModuleReleased(ApplicationModule appModule,
boolean isReleased)
May be customized to perform special release processing. |
protected void |
reconnect(ApplicationModule appModule,
java.util.Hashtable environment)
Deprecated. Replaced by oracle.jbo.common.ampool.ConnectionStrategy#reconnect(ApplicationModule, SessionCookie) .
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends DefaultConnectionStrategy . |
void |
releaseApplicationModule(SessionCookie cookie,
boolean manageState)
Mark the session's application module as available for reuse by other sessions. |
void |
releaseApplicationModule(SessionCookie cookie,
int releaseFlags)
Mark the session's application module as available for reuse by other sessions. |
protected void |
releaseInstance(ApplicationModule instance)
Deprecated. |
void |
releaseInstances()
Deprecated. Replaced by removeResources() . Method may be
confused with releaseResource.
|
void |
releaseResource(java.lang.Object resource,
java.util.Properties properties)
|
protected boolean |
removeFromManager()
|
protected boolean |
removeResourceInternal(java.lang.Object resource)
|
com.sun.java.util.collections.ArrayList |
removeResources()
Remove all of the pool application module instances that have been created so far. |
void |
removeSessionCookie(SessionCookie cookie)
Destroy a session cookie. |
protected java.lang.Object |
seekLRUAvailableResource(java.lang.Object refResource)
Return the least recently used available resource in the pool. |
protected java.lang.Object |
seekMRUAvailableResource(java.lang.Object refResource)
Return the most recently used available resource in the pool. |
void |
setAvailable(ApplicationModule appModule)
This method may be used by clients if they are manually populating the pool with application module instances using #createInstance()
to notify the pool when a new instance is ready for use by other threads. |
void |
setConnectionStrategy(ConnectionStrategy strategy)
Set the application module strategy that will be used to create, connect, disconnect, and reconnect the application module. |
void |
setPassword(java.lang.String password)
Deprecated. This value should be passed to the pool connection strategy as SessionCookie environment or by implementing an EnvInfoProvider. The value may be set in the ApplicationPool or SessionCookie environment by using the Configuration.DB_PASSWORD_PROPERTY key. |
void |
setSessionCookieFactory(SessionCookieFactory sessionCookieFactory)
Set the factory that will be used to create new session cookie instances. |
protected boolean |
setState(java.lang.Object appModule,
byte state,
java.util.Properties props)
|
void |
setUserData(java.util.Hashtable userData)
Replaces the userData with the new Hashtable. |
void |
setUserName(java.lang.String userName)
Deprecated. This value should be passed to the pool connection strategy as SessionCookie environment or by implementing an EnvInfoProvider. The value may be set in the ApplicationPool or SessionCookie environment by using the Configuration.DB_USERNAME_PROPERTY key. |
ApplicationModule |
useApplicationModule(SessionCookie cookie,
boolean checkout)
Returns an application module for the specified session cookie. |
java.lang.Object |
useResource(java.util.Properties properties)
|
boolean |
validateSessionCookie(SessionCookie cookie)
Validate that a session cookie is a valid handle for this pool. |
boolean |
validateSessionCookieInPool(SessionCookie cookie)
Validate that a session cookie is a member of this pool. |
Methods inherited from class oracle.jbo.pool.ResourcePool |
addResource, addToRemoveList, allocateResource, createInitializer, createResource, decrementRefCount, dumpPoolStatistics, getAvailableResourceCount, getCreationTimeMillis, getInitializer, getRefCount, getResource, getResourceCount, getResourceInfo, getResourcePoolStatistics, getState, getSyncLock, getTimeToCreateMillis, incrementRefCount, initialize, isAvailable, logPoolEvent, removeResource, setAvailable, setAvailable, wakeup |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface oracle.jbo.common.ampool.ApplicationPool |
dumpPoolStatistics, removeResource |
Field Detail |
public static int CREATION_POLICY_SERIAL
public static int CREATION_POLICY_ROUND_ROBIN
public static int MAX_HANDLE_POLICY_SPILL
public static int MAX_HANDLE_POLICY_ERROR
Constructor Detail |
public ApplicationPoolImpl()
Method Detail |
public long getSignature()
ApplicationPool
The pool signature will also be used to determine whether a cookie is a valid handle to the pool instance. The pool signature value should be unique across pools and consistent across VMs.
getSignature
in interface ApplicationPool
ApplicationPool.validateSessionCookie(SessionCookie)
public void initialize()
public void initialize(java.lang.String name, java.lang.String applicationModuleClassName, java.lang.String connectString, java.util.Hashtable env)
ApplicationPool
initialize
in interface ApplicationPool
name
- the name of the application module pool.applicationModuleClassName
- name of the application module for which the pool
will be created.connectString
- the connection string to use to connect to the
database.env
- name of the hash table containing the environment variables for
the selected platform.public ConnectionStrategy getConnectionStrategy()
ApplicationPool
getConnectionStrategy
in interface ApplicationPool
public void setConnectionStrategy(ConnectionStrategy strategy)
ApplicationPool
setConnectionStrategy
in interface ApplicationPool
public SessionCookieFactory getSessionCookieFactory()
ApplicationPool
getSessionCookieFactory
in interface ApplicationPool
public void setSessionCookieFactory(SessionCookieFactory sessionCookieFactory)
ApplicationPool
setSessionCookieFactory
in interface ApplicationPool
public int getMaxPoolSize()
ApplicationPool
getMaxPoolSize
in interface ApplicationPool
public int getInitPoolSize()
ApplicationPool
getInitPoolSize
in interface ApplicationPool
public SessionCookie createSessionCookie(java.lang.String applicationId, java.lang.String sessionId, java.util.Properties properties)
ApplicationPool
createSessionCookie
in interface ApplicationPool
applicationId
- an identifier which may be used to uniquely
identify this cookie within the context of a session
sessionId
- an option identifier which may be used to uniquely
identify this cookie across sessions.
properties
- an optional properties object which may be used
to pass additional creation properties to the SessionCookieFactory.public void addSessionCookie(SessionCookie cookie)
ApplicationPool
addSessionCookie
in interface ApplicationPool
ApplicationPool.createSessionCookie(String, String, Properties)
,
ApplicationPool.validateSessionCookie(SessionCookie)
public void removeSessionCookie(SessionCookie cookie)
ApplicationPool
removeSessionCookie
in interface ApplicationPool
public java.lang.String getApplicationModuleClass()
ApplicationPool
getApplicationModuleClass
in interface ApplicationPool
public java.lang.String getConnectString()
getConnectString
in interface ApplicationPool
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
public java.util.Hashtable getEnvironment()
ApplicationPool
getEnvironment
in interface ApplicationPool
protected final java.lang.Object getResourceDetails(java.lang.Object resource)
protected final java.lang.Object seekLRUAvailableResource(java.lang.Object refResource)
Applications should not use this method.
refResource
- if not null returns the resource that was less recently
used than the reference resource.protected final java.lang.Object seekMRUAvailableResource(java.lang.Object refResource)
Applications should not use this method.
refResource
- if not null returns the resource that was more recently
used than the reference resource.protected final void finalizeResource(java.lang.Object resource, java.lang.Object details)
public void checkin(ApplicationModule appModule)
SessionCookie.releaseApplicationModule(int)
.
Application developers should invoke:
SessionCookie.releaseApplicationModule(SessionCookie.SHARED_UNMANAGED_RELEASE_MODE)
instead of this method. A session cookie instance may be acquired by
invoking:
createSessionCookie(String, String, Properties)
.
This change was necessary to support the SessionCookie interface. Please
see:
SessionCookie
for more information about using SessionCookies with the application pool.
checkin
in interface ApplicationPool
appModule
- name of the application module instance to check in.
SessionCookie.releaseApplicationModule(int)
,
ApplicationModuleRef.useApplicationModule()
public void releaseApplicationModule(SessionCookie cookie, boolean manageState)
ApplicationPool
If the managed flag is true then the pool will maintain logical application module state while still sharing an application module resource between sessions.
When an application module is marked available with managed state the application module will be passivated immediately if failover support has been requested (default). If failover support has been disabled, through the jbo.DoFailover system parameter, the application module will not be passivated until it is re-used by a session other than the session releasing in the application module.
Please see SessionCookie
for more
information regarding session identification and application state
tracking.
releaseApplicationModule
in interface ApplicationPool
cookie
- a session cookie equal to the session cookie that was
generated during checkoutmanageState
- indicates if the session's application module state
should be managed by the pool
public void releaseApplicationModule(SessionCookie cookie, int releaseFlags)
ApplicationPool
If the managed flag is true then the pool will maintain logical application module state while still sharing an application module resource between sessions.
When an application module is marked available with managed state the application module will be passivated immediately if failover support has been requested (default). If failover support has been disabled, through the jbo.DoFailover system parameter, the application module will not be passivated until it is re-used by a session other than the session releasing in the application module.
Please see SessionCookie
for more
information regarding session identification and application state
tracking.
The ApplicationPool supports the following release modes:
SHARED_MANAGED_RELEASE_MODE: Release the ApplicationModule for re-use by other sessions. Manage this session's ApplicationModule state.
SHARED_UNMANAGED_RELEASE_MODE: Release the ApplicationModule for re-use by other sessions. Do not manage this session's ApplicationModule state.
RESERVED_UNMANAGED_RELEASE_MODE: Do not release the ApplicationModule for re-use by other sessions. Do not manage this session's ApplicationModule state. This mode would be used if failover is not required.
RESERVED_MANAGED_RELEASE_MODE: Do not release the ApplicationModule for re-use by other sessions. Manage this session's ApplicationModule state. This mode would be used if failover is required for a reserved ApplicationModule instance.
releaseApplicationModule
in interface ApplicationPool
cookie
- a session cookie equal to the session cookie that was
generated during checkoutreleaseFlags
- the desired releaseFlags. Must be one of the
following release modes:
SHARED_MANAGED_RELEASE_MODE
SHARED_UNMANAGED_RELEASE_MODE
RESERVED_UNMANAGED_RELEASE_MODE
RESERVED_MANAGED_RELEASE_MODEpublic java.lang.String checkinWithSessionState(ApplicationModule appModule)
SessionCookie.releaseApplicationModule(boolean, boolean)
.
Application developers should invoke: SessionCookie.releaseApplicationModule(true, true)
instead of this method. A session cookie instance may be acquired by
invoking:
createSessionCookie(String, String, Properties)
.
This change was necessary to support the SessionCookie interface. Please
see:
SessionCookie
for more information about using SessionCookies with the application pool.
This method should be used by pool clients that wish to maintain logical application module state while still sharing an application module resource across requests. The method returns a system generated session id for the check-in that should be used as the unique application module identifier by the client session.
The application module will be passivated immediately if failover support has been requested (default). If failover support has been disable, through the jbo.DoFailover system parameter, the application module will not be passivated until it is re-used by a session other than the session checking in the application module.
checkinWithSessionState
in interface ApplicationPool
appModule
- the application module that will be checked in
SessionCookie.releaseApplicationModule(boolean, boolean)
,
ApplicationModuleRef.useApplicationModule()
public ApplicationModule createNewInstance() throws java.lang.Exception
ConnectionStrategy.createApplicationModule(SessionCookie, EnvInfoProvider)
.
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends:
DefaultConnectionStrategy
.
createNewInstance
in interface ApplicationPool
java.lang.Exception
ConnectionStrategy.createApplicationModule(SessionCookie, EnvInfoProvider)
public java.lang.Object instantiateResource(java.util.Properties properties)
public ApplicationModule checkout() throws java.lang.Exception
ApplicationModuleRef.useApplicationModule()
.
Application developers should invoke: SessionCookie.useApplicationModule()
instead of this method. A session cookie instance may be acquired by
invoking:
createSessionCookie(String, String, Properties)
.
This change was necessary to support the SessionCookie interface. Please
see:
SessionCookie
for more information about using SessionCookies with the application pool.
checkout
in interface ApplicationPool
java.lang.Exception
ApplicationModuleRef.useApplicationModule()
,
SessionCookie.releaseApplicationModule(boolean, boolean)
public void releaseInstances()
removeResources()
. Method may be
confused with releaseResource.
releaseInstances
in interface ApplicationPool
removeResources()
protected void releaseInstance(ApplicationModule instance)
ResourcePool.removeResource(Object)
protected boolean removeResourceInternal(java.lang.Object resource)
public com.sun.java.util.collections.ArrayList removeResources()
ApplicationPool
The remove() method is called on the Application Modules being represented by the application instance class
removeResources
in interface ApplicationPool
public int getAvailableInstanceCount()
ApplicationPool
getAvailableInstanceCount
in interface ApplicationPool
public int getAvailableNumPools()
getAvailableInstanceCount()
getAvailableNumPools
in interface ApplicationPool
getAvailableInstanceCount()
public int getInstanceCount()
ApplicationPool
getInstanceCount
in interface ApplicationPool
public ApplicationModule getInstance(int index)
getInstance
in interface ApplicationPool
public ApplicationModule checkout(java.lang.String cookieValue)
ApplicationModuleRef.useApplicationModule()
.
Application developers should invoke: SessionCookie.useApplicationModule()
instead of this method. A session cookie instance may be acquired by
invoking:
createSessionCookie(String, String, Properties)
.
This change was necessary to support the SessionCookie interface. Please
see:
SessionCookie
for more information about using SessionCookies with the application pool.
checkinWithSessionState(ApplicationModule)
against this application module pool.
The session id should be used to re-create an application module state from a previous request.
If an unrecognized session id is specified then the pool should return a stateless application module instance.
checkout
in interface ApplicationPool
cookieValue
- a session identifier from a previous requestApplicationModuleRef.useApplicationModule()
,
SessionCookie.releaseApplicationModule(boolean, boolean)
public ApplicationModule useApplicationModule(SessionCookie cookie, boolean checkout)
ApplicationPool
The requesting thread may obtain an application module with the state from a previous request by passing the previous request's cookie instance. The cookie should be used by the pool to re-create an application module state from a previous request.
If an "empty" session cookie is specified then the pool should return a
stateless application module instance. An empty session cookie is defined
as a cookie that does not reference a previous application module state.
Please see SessionCookie.getPassivationId()
for more information regarding application state maintenance.
In order to persist some internal state information, the application pool may mutate the specified cookie. Application pool clients should consequently be careful to reference the cookie value that is returned in the cookie value after checkout has been invoked.
useApplicationModule
in interface ApplicationPool
cookie
- an empty/previous session cookiepublic java.lang.String getPoolName()
getName()
.
getPoolName
in interface ApplicationPool
getName()
public java.lang.String getName()
ApplicationPool
getName
in interface ApplicationPool
public java.util.Hashtable getUserData()
ApplicationPool
getUserData
in interface ApplicationPool
public void setUserData(java.util.Hashtable userData)
ApplicationPool
setUserData
in interface ApplicationPool
public java.lang.String getUserName()
getUserName
in interface ApplicationPool
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
public void setUserName(java.lang.String userName)
setUserName
in interface ApplicationPool
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
public java.lang.String getPassword()
getPassword
in interface ApplicationPool
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
public void setPassword(java.lang.String password)
setPassword
in interface ApplicationPool
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
public void commitAndSyncCache(ApplicationModule instance)
ApplicationPool
This method commits the transaction for instance. Then, it loops through all other instances of the Application Module in the pool and synchronizes their caches with the changes committed by instance. For example:
// Insert a new row row = voEmp1.createRow(); row.setAttribute("EmpNum", new Integer(9999)); row.setAttribute("EmpName", "NewPers"); row.setAttribute("EmpJob", "JOBX"); voEmp1.insertRow(row); // Commit the changes for the specified instance, then sync // them with the rest of the Application Module instances. pool1.commitAndSyncCache(am1);
commitAndSyncCache
in interface ApplicationPool
instance
- an instance of an Application Module in the pool.protected boolean isInstanceAlive(ApplicationModule instance)
This method may be overriden to provide a custom test.
public boolean validateSessionCookieInPool(SessionCookie cookie)
ApplicationPool
validateSessionCookieInPool
in interface ApplicationPool
public boolean validateSessionCookie(SessionCookie cookie)
ApplicationPool
This method only validates that a SessionCookie was created by an
ApplicationPool with the same signature as the target ApplicationPool. It
is used by the default ApplicationPool implementation to verify that a
SessionCookie may be added to the target pool. It does not validate that
the SessionCookie is a valid member of the target ApplicationPool. Please
use ApplicationPool.validateSessionCookieInPool(SessionCookie)
to validate that a SessionCookie is a member of the target
ApplicationPool.
validateSessionCookie
in interface ApplicationPool
ApplicationPool.getSignature()
,
ApplicationPool.validateSessionCookieInPool(SessionCookie)
protected void notifyApplicationModuleReleased(ApplicationModule appModule, boolean isReleased)
Please note that this notification may be delivered while the ApplicationPool is still in an inconsistent state. A customizing pool should *not* attempt to work with the pool when handling this notification.
Customizing pools should also be careful to minimize the amount of work performed by any notification handler as this notification may be delivered while the ApplicationPool monitor is held therefore preventing other threads from using the ApplicationPool.
The notification will be delivered before the ApplicationModule is released -- though, in the case that the pool monitor is held this will not make a difference since this codepath will be single threaded.
protected boolean setState(java.lang.Object appModule, byte state, java.util.Properties props)
public void setAvailable(ApplicationModule appModule)
ApplicationPool
#createInstance()
to notify the pool when a new instance is ready for use by other threads.
Pool clients should not use this method after an application module
has been set available for the first time.
setAvailable
in interface ApplicationPool
appModule
- the application module which will be made availablepublic boolean isAvailable(ApplicationModule appModule)
isAvailable
in interface ApplicationPool
public long getCreationTimeMillis(ApplicationModule appModule)
ApplicationPool
getCreationTimeMillis
in interface ApplicationPool
appModule
- the application module instance for which you want to
know the time of creation.public long getTimeToCreateMillis(ApplicationModule appModule)
ApplicationPool
getTimeToCreateMillis
in interface ApplicationPool
appModule
- the application module instance for which you want to
know how long it will take to create it.protected int getMinAvailableSize()
protected int getMaxAvailableSize()
protected int getMaxInactiveAge()
protected int getTimeToLive()
protected int getRecycleThreshold()
protected oracle.jbo.pool.ResourcePoolLogger createPoolLogger()
public Statistics getStatistics()
ApplicationPool
getStatistics
in interface ApplicationPool
protected long getMaxWaitTime()
protected boolean compareConnectionMetadata(ConnectionMetadata oldConnectionMetadata, ConnectionMetadata newConnectionMetadata)
If compareConnectionMetadata returns true then the pool assumes that the oldConnectionMetadata and the newConnectionMetadata are equal and does not attempt to connect the application module with the new session connection metadata. If compareConnectionMetadata returns false then the pool assumes that the oldConnectionMetadata and the newConnectionMetadata are note equal and will attempt to connect the application module using the new connection metadata.
If it is known at design time that the connection metadata will not change then applications may set the property, jbo.ampool.dynamicjdbccredentials, equal to false. This will prevent the potential overhead of performing a disconnect/connect whenever a new session causes the pool to recycle an application module instance.
public java.lang.Object useResource(java.util.Properties properties)
public void releaseResource(java.lang.Object resource, java.util.Properties properties)
protected boolean isDoFailover()
SessionCookieImpl.isFailoverEnabled()
SessionCookie.isFailoverEnabled()
public boolean isDynamicJDBCCredentials()
public boolean isAMPoolingEnabled()
public boolean isUseExclusive()
protected boolean isDoConnectionPooling()
SessionCookieImpl.isConnectionPoolingEnabled()
SessionCookie.isConnectionPoolingEnabled()
protected void connect(ApplicationModule appModule, java.util.Hashtable environment)
oracle.jbo.common.ampool.ConnectionStrategy#connect(ApplicationModule, SessionCookie)
.
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends DefaultConnectionStrategy
.
oracle.jbo.ConnectionStrategy#connect(ApplicationModule, SessionCookie)
protected void reconnect(ApplicationModule appModule, java.util.Hashtable environment)
oracle.jbo.common.ampool.ConnectionStrategy#reconnect(ApplicationModule, SessionCookie)
.
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends DefaultConnectionStrategy
.
oracle.jbo.ConnectionStrategy#reconnect(ApplicationModule, SessionCookie)
protected void disconnect(ApplicationModule appModule, boolean retainState, java.util.Hashtable environment)
ConnectionStrategy.disconnect(ApplicationModule, boolean, SessionCookie)
.
All extending logic that was implemented here should be implemented in a
custom ConnectionStrategy class that extends DefaultConnectionStrategy
.
retainState
- Indicates whether the state of the application
module's caches should be retained while disconnecting. If true, the
application module's Transaction should have not database state.oracle.jbo.ConnectionStrategy#disconnect(ApplicationModule, boolean, SessionCookie)
protected java.lang.String getConnectionStrategyClassName()
protected java.lang.String getSessionCookieFactoryClassName()
public java.lang.String getEnvConfigurationName()
ApplicationPool
getEnvConfigurationName
in interface ApplicationPool
public long getTimeCreated()
protected boolean removeFromManager()
protected java.lang.Object getResourcePoolKey()
|
Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.