Business Components

oracle.jbo.common.ampool
Interface ApplicationPool

All Known Implementing Classes:
ApplicationPoolImpl

public interface ApplicationPool

This is the ApplicationPool interface. It needs to be implemented by any class that is intended to provide a customized pool interface. Look at ApplicationPoolImpl for the default implementation. View Implementation of ApplicationPool View Implementation of ApplicationPoolImpl


Method Summary
 void checkin(ApplicationModule instance)
          Checks in an application instance that had previously been checked out.
 ApplicationModule checkout()
          Checks out an application instance from the pool.
 void commitAndSyncCache(ApplicationModule instance)
          Given an intitial Application Module instance, synchronizes the caches of all Application Module instances in the pool.
 ApplicationModule createNewInstance()
          This create a new instance of an application without looking for an available instance in the pool.
 java.lang.String getApplicationModuleClass()
          Return the class name of the application modules being managed by the pool.
 int getAvailableNumPools()
          Gets the snapshot of available number of pools returns number of available pools
 java.lang.String getConnectString()
          Return the connect string of the application modules being managed by the application pool.
 java.lang.Object getCookie(ApplicationModule instance)
           
 long getCreationTimeMillis(ApplicationModule instance)
          Get the time when the app module was created (in milli-secs).
 java.util.Hashtable getEnvironment()
          Returns the Hashtable that was used to initialie the Contect for the application modules.
 ApplicationModule getInstance(int nIndex)
          Returns the application instance represented by the instance index.
 ApplicationModule getInstanceByCookie(java.lang.Object cookie, boolean checkout)
           
 int getInstanceCount()
          Returns the number of instances that the Application Pool has created.
 java.lang.String getPassword()
          Returns the password
 java.lang.String getPoolName()
          Returns the pool's name.
 long getTimeToCreateMillis(ApplicationModule instance)
          Get the time when the app module was created (in milli-secs).
 java.util.Hashtable getUserData()
          returns the User Data hashtable.
 java.lang.String getUserName()
          Returns the user name
 void initialize(java.lang.String sPoolName, java.lang.String sApplicationModule, java.lang.String sConnectString, java.util.Hashtable env)
          This initializes the ApplicationPool.
 boolean isAvailable(ApplicationModule instance)
          Returns true if the application module is available
 void releaseInstances()
          Causes the pool to release all the application isntances that have been created so far.
 void setAvailable(ApplicationModule instance, boolean bSet)
          Sets the instance to available or not
 void setPassword(java.lang.String sPassword)
           
 void setUserData(java.util.Hashtable data)
          Replaces the userData with the new Hashtable.
 void setUserName(java.lang.String sUser)
           
 

Method Detail

initialize

public void initialize(java.lang.String sPoolName,
                       java.lang.String sApplicationModule,
                       java.lang.String sConnectString,
                       java.util.Hashtable env)
                throws java.lang.Exception
This initializes the ApplicationPool. The Pool name should be unique with respect to any other pools. An exception will be thrown on any errors such as duplicate pool name or mismatched information within the connectInfo parameter. Take a close look at the ConnectInfo documentation since it controls the key information for initializing the application pool.

getApplicationModuleClass

public java.lang.String getApplicationModuleClass()
Return the class name of the application modules being managed by the pool.

getConnectString

public java.lang.String getConnectString()
Return the connect string of the application modules being managed by the application pool.

getEnvironment

public java.util.Hashtable getEnvironment()
Returns the Hashtable that was used to initialie the Contect for the application modules.

checkin

public void checkin(ApplicationModule instance)
Checks in an application instance that had previously been checked out. This makes the application instance avalable for subsequent checkout requests from this pool.

isAvailable

public boolean isAvailable(ApplicationModule instance)
Returns true if the application module is available

setAvailable

public void setAvailable(ApplicationModule instance,
                         boolean bSet)
Sets the instance to available or not

checkout

public ApplicationModule checkout()
                           throws java.lang.Exception
Checks out an application instance from the pool. If the pool doesn't have any available instances, it will create a new instance and return it to the caller.

releaseInstances

public void releaseInstances()
Causes the pool to release all the application isntances that have been created so far. The remove() method is called on the Application Modules being represented by the application instance class

getInstanceCount

public int getInstanceCount()
Returns the number of instances that the Application Pool has created.

createNewInstance

public ApplicationModule createNewInstance()
                                    throws java.lang.Exception
This create a new instance of an application without looking for an available instance in the pool. This method should not be called directly, you should call checkout() .

getInstance

public ApplicationModule getInstance(int nIndex)
Returns the application instance represented by the instance index.

getInstanceByCookie

public ApplicationModule getInstanceByCookie(java.lang.Object cookie,
                                             boolean checkout)

getCookie

public java.lang.Object getCookie(ApplicationModule instance)

getPoolName

public java.lang.String getPoolName()
Returns the pool's name.

getUserData

public java.util.Hashtable getUserData()
returns the User Data hashtable. This is a generic container for any settings the user would like to associate with this application pool.

setUserData

public void setUserData(java.util.Hashtable data)
Replaces the userData with the new Hashtable.

getAvailableNumPools

public int getAvailableNumPools()
Gets the snapshot of available number of pools returns number of available pools

getTimeToCreateMillis

public long getTimeToCreateMillis(ApplicationModule instance)
Get the time when the app module was created (in milli-secs).

getCreationTimeMillis

public long getCreationTimeMillis(ApplicationModule instance)
Get the time when the app module was created (in milli-secs).

getUserName

public java.lang.String getUserName()
Returns the user name

getPassword

public java.lang.String getPassword()
Returns the password

setUserName

public void setUserName(java.lang.String sUser)

setPassword

public void setPassword(java.lang.String sPassword)

commitAndSyncCache

public void commitAndSyncCache(ApplicationModule instance)
Given an intitial Application Module instance, synchronizes the caches of all Application Module instances in the pool.

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);
 

Parameters:
instance - an instance of an Application Module in the pool.

Business Components