|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | 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 |
Type | Field |
---|---|
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, WAIT_TIME_INCREMENT |
Constructor Summary |
ApplicationPoolImpl()
Constructor |
Method Summary |
Type | Method |
---|---|
void |
addSessionCookie(SessionCookie cookie)
Add an existing session cookie to the pool. |
void |
checkin(ApplicationModule appModule)
Checks in an application instance that had previously been checked out. |
java.lang.String |
checkinWithSessionState(ApplicationModule appModule)
Check-in the application module as being referenced by the invoking session thread. |
ApplicationModule |
checkout()
Checks out stateless application instance from the pool. |
ApplicationModule |
checkout(java.lang.String cookieValue)
Returns an application module for the specified session. |
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 cookieValue,
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)
Invoked during pool high water mark resolution. |
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. Please see (@link oracle.jbo.common.ampool.DefaultConnectionStrategy} for more information. |
long |
getCreationTimeMillis(ApplicationModule appModule)
Gets the time when the app module was created (in milli-secs). |
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()
Return the maximum number of available instances that should exist in the pool after pool garbage collection. |
protected int |
getMaxInactiveAge()
Return the duration in milliseconds that a resource may remain available before it is considered inactive. |
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()
Return the minimum number of available instances that should exist in the pool after pool garbage collection. |
java.lang.String |
getName()
Returns the pool's name. |
java.lang.String |
getPassword()
Returns the password. |
java.lang.String |
getPoolName()
Deprecated. Replaced by #getName(). |
protected int |
getRecycleThreshold()
|
protected java.lang.Object |
getResourceDetails(java.lang.Object resource)
This method is invoked for every removal candidate when the pool high water mark is reached. |
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. |
long |
getTimeToCreateMillis(ApplicationModule appModule)
Gets the time that it will tke to create the application module (in milli-secs). |
java.util.Hashtable |
getUserData()
Returns the User Data hashtable. |
java.lang.String |
getUserName()
Returns the user name. |
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)
Instantiate a new pooled resource. |
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. |
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. |
protected void |
releaseInstance(ApplicationModule instance)
Deprecated. |
void |
releaseInstances()
Deprecated. Replaced by oracle.jbo.pool.removeResources() . Method
may be confused with releaseResource. |
void |
releaseResource(java.lang.Object resource,
java.util.Properties properties)
Release a resource that was previously acquired from the pool with useResource(Properties) . |
java.lang.Object |
removeResource(java.lang.Object resource)
Remove the resource from the application pool. |
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. |
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 |
setAvailable(ApplicationModule appModule,
boolean isAvailable)
Deprecated. Implementation detail. Modifying an application module's available status could result in concurrency issues. setAvailable(ApplicationModule)
may be invoked to set an unused application module as available. |
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. Please see (@link oracle.jbo.common.ampool.DefaultConnectionStrategy} for more information. |
void |
setSessionCookieFactory(SessionCookieFactory sessionCookieFactory)
Set the factory that will be used to create new session cookie instances. |
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. Please see (@link oracle.jbo.common.ampool.DefaultConnectionStrategy} for more information. |
ApplicationModule |
useApplicationModule(SessionCookie cookie,
boolean checkout)
Returns an application module for the specified session cookie. |
java.lang.Object |
useResource(java.util.Properties properties)
Acquire a resource from the pool for exclusive use. |
boolean |
validateSessionCookie(SessionCookie cookie)
Validate that a session cookie is a valid handle for this pool. |
Methods inherited from class oracle.jbo.pool.ResourcePool |
addResource, allocateResource, createResource, dumpPoolStatistics, firePoolEvent, getAvailableResourceCount, getCreationTimeMillis, getInitializer, getResource, getResourceCount, getResourceInfo, getResources, getSyncLock, getTimeToCreateMillis, initialize,
isAvailable, seekLRUAvailableResource, seekMRUAvailableResource, 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 |
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
oracle.jbo.common.ampool.ApplicationPool
#isValidSessionCookie(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
oracle.jbo.common.ampool.ApplicationPool
poolName
- the name of the application module pool.applicationModule
- 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
getMaxPoolSize
in class oracle.jbo.pool.ResourcePool
oracle.jbo.pool.ResourcePool
ResourcePool.allocateResource()
public int getInitPoolSize()
ApplicationPool
getInitPoolSize
in interface ApplicationPool
getInitPoolSize
in class oracle.jbo.pool.ResourcePool
public SessionCookie createSessionCookie(java.lang.String applicationId, java.lang.String cookieValue, java.util.Properties properties)
ApplicationPool
createSessionCookie
in interface ApplicationPool
oracle.jbo.common.ampool.ApplicationPool
applicationId
- identifies the session applicationcookieValue
- a cookieValue from a previous requestproperties
- additional user properties. This parameter may be used
to pass application specific information to a session cookie factory.public void addSessionCookie(SessionCookie cookie)
ApplicationPool
addSessionCookie
in interface ApplicationPool
oracle.jbo.common.ampool.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 java.lang.Object getResourceDetails(java.lang.Object resource)
oracle.jbo.pool.ResourcePool
getResourceDetails
in class oracle.jbo.pool.ResourcePool
protected void finalizeResource(java.lang.Object resource, java.lang.Object details)
oracle.jbo.pool.ResourcePool
finalizeResource
in class oracle.jbo.pool.ResourcePool
public void checkin(ApplicationModule appModule)
ApplicationModuleRef.releaseApplicationModule(boolean, boolean)
.
Application developers should invoke SessionCookie.releaseApplicationModule(true, false)
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.
ApplicationPool
checkin
in interface ApplicationPool
ApplicationModuleRef.releaseApplicationModule(boolean, boolean)
,
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
oracle.jbo.common.ampool.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 poolpublic java.lang.String checkinWithSessionState(ApplicationModule appModule)
ApplicationModuleRef.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.
ApplicationPool
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
ApplicationModuleRef.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
ConnectionStrategy.createApplicationModule(SessionCookie,
EnvInfoProvider)
public java.lang.Object instantiateResource(java.util.Properties properties)
oracle.jbo.pool.ResourcePool
ResourcePool.useResource(Properties)
if it is necessary to create a new pooled resource. Applications should
implement this method to return a new instance of a pooled resource.instantiateResource
in class oracle.jbo.pool.ResourcePool
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.
ApplicationPool
checkout
in interface ApplicationPool
ApplicationModuleRef.useApplicationModule()
,
ApplicationModuleRef.releaseApplicationModule(boolean, boolean)
public void releaseInstances()
oracle.jbo.pool.removeResources()
. Method
may be confused with releaseResource.
releaseInstances
in interface ApplicationPool
removeResources()
protected void releaseInstance(ApplicationModule instance)
removeResource(Object)
public java.lang.Object removeResource(java.lang.Object resource)
ApplicationPool
The remove() method is called on the Application Module being represented by the application instance class
removeResource
in interface ApplicationPool
removeResource
in class oracle.jbo.pool.ResourcePool
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
removeResources
in class oracle.jbo.pool.ResourcePool
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.
ApplicationPool
ApplicationPool.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
ApplicationModuleRef.useApplicationModule()
,
ApplicationModuleRef.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
oracle.jbo.common.ampool.ApplicationPool
cookie
- an empty/previous session cookiepublic java.lang.String getPoolName()
getPoolName
in interface ApplicationPool
getName()
public java.lang.String getName()
ApplicationPool
getName
in interface ApplicationPool
getName
in class oracle.jbo.pool.ResourcePool
public java.util.Hashtable getUserData()
ApplicationPool
getUserData
in interface ApplicationPool
public void setUserData(java.util.Hashtable userData)
ApplicationPool
setUserData
in interface ApplicationPool
oracle.jbo.common.ampool.ApplicationPool
the
- new hashtable to use for the environment information.public java.lang.String getUserName()
ApplicationPool
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()
ApplicationPool
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
oracle.jbo.common.ampool.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 validateSessionCookie(SessionCookie cookie)
ApplicationPool
validateSessionCookie
in interface ApplicationPool
oracle.jbo.common.ampool.ApplicationPool
ApplicationPool.getSignature()
public void setAvailable(ApplicationModule appModule, boolean isAvailable)
setAvailable(ApplicationModule)
may be invoked to set an unused application module as available.
setAvailable
in interface ApplicationPool
#setAvailable(appModule)
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
oracle.jbo.common.ampool.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
oracle.jbo.common.ampool.ApplicationPool
instance
- the application module instance for which you want to
know the time of creation.public long getTimeToCreateMillis(ApplicationModule appModule)
ApplicationPool
getTimeToCreateMillis
in interface ApplicationPool
oracle.jbo.common.ampool.ApplicationPool
instance
- the application module instance for which you want to
know how long it will take to create it.protected int getMinAvailableSize()
oracle.jbo.pool.ResourcePool
An available resource is defined as inactive if it has not been used for a duration longer than the pool's maximum inactive age.
getMinAvailableSize
in class oracle.jbo.pool.ResourcePool
oracle.jbo.pool.ResourcePool
ResourcePool.getMaxInactiveAge()
protected int getMaxAvailableSize()
oracle.jbo.pool.ResourcePool
getMaxAvailableSize
in class oracle.jbo.pool.ResourcePool
protected int getMaxInactiveAge()
oracle.jbo.pool.ResourcePool
getMaxInactiveAge
in class oracle.jbo.pool.ResourcePool
oracle.jbo.pool.ResourcePool
ResourcePool.getMinAvailableSize()
protected int getRecycleThreshold()
protected oracle.jbo.pool.ResourcePoolLogger createPoolLogger()
createPoolLogger
in class oracle.jbo.pool.ResourcePool
protected long getMaxWaitTime()
getMaxWaitTime
in class oracle.jbo.pool.ResourcePool
oracle.jbo.pool.ResourcePool
ResourcePool.getMaxPoolSize()
,
ResourcePool.allocateResource()
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)
oracle.jbo.pool.ResourcePool
useResource
in class oracle.jbo.pool.ResourcePool
public void releaseResource(java.lang.Object resource, java.util.Properties properties)
oracle.jbo.pool.ResourcePool
ResourcePool.useResource(Properties)
. Throws an exception if the resource
was not checked out from the pool.releaseResource
in class oracle.jbo.pool.ResourcePool
protected boolean isDoFailover()
SessionCookieImpl.isFailoverEnabled()
SessionCookie.isFailoverEnabled()
public boolean isDynamicJDBCCredentials()
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()
|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |