public interface ApplicationPool
extends java.io.Serializable
Modifier and Type | Method and Description |
---|---|
void |
addSessionCookie(SessionCookie cookie)
Add an existing session cookie to the pool.
|
void |
checkin(ApplicationModule instance)
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(int) .
Application developers should invoke: SessionCookie.releaseApplicationModule(SessionCookie.SHARED_MANAGED_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:
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 sessionId)
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.
|
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 .
|
SessionCookie |
createSessionCookie(java.lang.String applicationId,
java.lang.String sessionId,
java.util.Properties properties)
Create a session cookie for access to this pool.
|
void |
dumpPoolStatistics(java.io.PrintWriter pw) |
SessionCookie |
findOrCreateSessionCookie(java.lang.String applicationId,
java.lang.String sessionId,
java.util.Properties properties)
Returns the specified session cookie.
|
SessionCookie |
findSessionCookie(java.lang.String applicationId,
java.lang.String sessionId)
Returns the specified session cookie.
|
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.
|
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 Configuration.DB_CONNECT_STRING_PROPERTY key.
|
long |
getCreationTimeMillis(ApplicationModule instance)
Gets the time when the app module was created (in milli-secs).
|
java.lang.String |
getEnvAppModuleClassName()
Return the name of the ApplicationModule class that is managed by
this ApplicationPool.
|
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)
Deprecated.
Implementation detail. This method has been made protected.
Pool clients should not access pooled instances directly. Use
ApplicationModuleRef.useApplicationModule()
to acquire ApplicationModule instances instead.
|
int |
getInstanceCount()
Returns the number of instances that the Application Pool has created.
|
int |
getMaxPoolSize()
Get the maximum number of application module instances which may
be referenced by the application pool.
|
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() . |
SessionCookieFactory |
getSessionCookieFactory()
Get the factory that will be used to create new session cookie instances.
|
long |
getSignature()
Return a signature for the application pool.
|
Statistics |
getStatistics()
Returns the pool statistics.
|
long |
getTimeToCreateMillis(ApplicationModule instance)
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()
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(java.lang.String poolName,
java.lang.String applicationModule,
java.lang.String connectString,
java.util.Hashtable env)
This initializes the ApplicationPool.
|
boolean |
isAvailable(ApplicationModule appModule)
Deprecated.
Implementation detail. This method has been made protected.
|
void |
releaseApplicationModule(SessionCookie cookie,
boolean manageState)
Deprecated.
since 9.0.3
Use releaseApplicationModule(cookie, SessionCookie.SHARED_MANAGED_RELEASE_MODE) Otherwise invoke: releaseApplicationModule(cookie, SessionCookie.SHARED_UNMANAGED_RELEASE_MODE) |
void |
releaseApplicationModule(SessionCookie cookie,
int releaseFlags)
Mark the session's application module as available for reuse by other
sessions.
|
void |
releaseInstances()
Deprecated.
Replaced by:
ResourcePool.removeResources() . Method
may be confused with releaseResource. |
java.lang.Object |
removeResource(java.lang.Object resource)
Remove the resource from the application pool.
|
java.util.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
createNewInstance()
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 sPassword)
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.
|
void |
setUserData(java.util.Hashtable data)
Replaces the userData with the new Hashtable.
|
void |
setUserName(java.lang.String sUser)
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.
|
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.
|
void initialize(java.lang.String poolName, java.lang.String applicationModule, java.lang.String connectString, java.util.Hashtable env)
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.java.lang.String getApplicationModuleClass()
java.util.Hashtable getEnvironment()
void setAvailable(ApplicationModule appModule)
createNewInstance()
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.appModule
- the application module which will be made availableApplicationModule useApplicationModule(SessionCookie cookie, boolean checkout)
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.
cookie
- an empty/previous session cookievoid releaseApplicationModule(SessionCookie cookie, boolean manageState)
Use releaseApplicationModule(SessionCookie,int)
instead. If
state management is required then invoke:
releaseApplicationModule(cookie, SessionCookie.SHARED_MANAGED_RELEASE_MODE)
Otherwise invoke:
releaseApplicationModule(cookie, SessionCookie.SHARED_UNMANAGED_RELEASE_MODE)
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.
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
void releaseApplicationModule(SessionCookie cookie, int releaseFlags)
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.
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_MODEjava.util.ArrayList removeResources()
The remove() method is called on the Application Modules being represented by the application instance class
java.lang.Object removeResource(java.lang.Object resource)
The remove() method is called on the Application Module being represented by the application instance class
int getInstanceCount()
int getAvailableInstanceCount()
java.lang.String getName()
java.util.Hashtable getUserData()
void setUserData(java.util.Hashtable data)
data
- the new hashtable to use for the environment information.long getTimeToCreateMillis(ApplicationModule instance)
instance
- the application module instance for which you want to
know how long it will take to create it.long getCreationTimeMillis(ApplicationModule instance)
instance
- the application module instance for which you want to
know the time of creation.void commitAndSyncCache(ApplicationModule instance)
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);
instance
- an instance of an Application Module in the pool.ConnectionStrategy getConnectionStrategy()
void setConnectionStrategy(ConnectionStrategy strategy)
SessionCookieFactory getSessionCookieFactory()
void setSessionCookieFactory(SessionCookieFactory sessionCookieFactory)
SessionCookie createSessionCookie(java.lang.String applicationId, java.lang.String sessionId, java.util.Properties properties)
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.SessionCookie findOrCreateSessionCookie(java.lang.String applicationId, java.lang.String sessionId, java.util.Properties properties)
SessionCookie findSessionCookie(java.lang.String applicationId, java.lang.String sessionId)
void addSessionCookie(SessionCookie cookie)
void removeSessionCookie(SessionCookie cookie)
boolean validateSessionCookie(SessionCookie cookie)
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 validateSessionCookieInPool(SessionCookie)
to validate that a SessionCookie is a member of the target
ApplicationPool.
boolean validateSessionCookieInPool(SessionCookie cookie)
createSessionCookie(String, String, Properties)
.
SessionCookie(s) are unregistered as an ApplicationPool member when they
are removed from an an ApplicationPool with
removeSessionCookie(SessionCookie)
.long getSignature()
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.
validateSessionCookie(SessionCookie)
void dumpPoolStatistics(java.io.PrintWriter pw)
Statistics getStatistics()
int getMaxPoolSize()
int getInitPoolSize()
java.lang.String getEnvConfigurationName()
java.lang.String getEnvAppModuleClassName()
boolean isAvailable(ApplicationModule appModule)
java.lang.String getPoolName()
getName()
.getName()
ApplicationModule getInstance(int index)
ApplicationModuleRef.useApplicationModule()
to acquire ApplicationModule instances instead.
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
.
java.lang.Exception
ConnectionStrategy.createApplicationModule(SessionCookie, EnvInfoProvider)
int getAvailableNumPools()
getAvailableInstanceCount()
getAvailableInstanceCount()
void checkin(ApplicationModule instance)
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.
instance
- name of the application module instance to check in.
SessionCookie.releaseApplicationModule(int)
,
ApplicationModuleRef.useApplicationModule()
java.lang.String checkinWithSessionState(ApplicationModule appModule)
SessionCookie.releaseApplicationModule(int)
.
Application developers should invoke: SessionCookie.releaseApplicationModule(SessionCookie.SHARED_MANAGED_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.
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.
appModule
- the application module that will be checked in
SessionCookie.releaseApplicationModule(int)
,
ApplicationModuleRef.useApplicationModule()
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.
java.lang.Exception
ApplicationModuleRef.useApplicationModule()
,
SessionCookie.releaseApplicationModule(int)
ApplicationModule checkout(java.lang.String sessionId)
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.
sessionId
- a session identifier from a previous requestApplicationModuleRef.useApplicationModule()
,
SessionCookie.releaseApplicationModule(int)
java.lang.String getUserName()
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
void setUserName(java.lang.String sUser)
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
java.lang.String getPassword()
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
void setPassword(java.lang.String sPassword)
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
java.lang.String getConnectString()
ConnectionStrategy
,
EnvInfoProvider
,
SessionCookie
void releaseInstances()
ResourcePool.removeResources()
. Method
may be confused with releaseResource.
ResourcePool.removeResources()