|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.7.0) E10653-08 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jbo.common.ampool.PoolTester
public class PoolTester
The PoolTester class provides a sample implementation and use of Application Module Pooling in LOCAL mode. This example uses the default implementation of Application Module Pooling.
View implementation of PoolTester
Create the pool TestAMPool. Since PoolMgr is a singleton object, use PoolMgr.getInstance to get it. Use createPool to create the pool. Notice that createPool requires the name of the pool, the name of the package that contains the Application Module, the connect string to the database, and env, the hashtable. The createPool method is overloaded; an alternative version takes an additional parameter that lets you override the default implementation of Application Module Pooling and specify your own.
Create a second pool, SecondAMPool that connects with the same environment variables, but to an Application Module in a different package.
PoolMgr.getInstance().getPool("TestAMPool") gets a handle to the pool to work with it.
Checkout three instances. Note that the classes ApplicationPoolImpl and PoolMgr contain other functions that you can use to traverse the pool content. The ampool package also contains a PoolAdministrator Web Bean that you can use to dump the contents of the pool.
Get a handle to the second pool, check out two instances, then check in one.
Use removePool to remove the Application Module Pool. This function calls remove() on all of the Application Module instances, including ones that are currently checked out and in use, and causes them to disconnect from the database and remove all of their View Objects.
The next part of the program defines a class, CustomPool, that ensures that no more than three instances are checked out of the pool at any time. In this case, the definition of the checkout method is overridden to check that no more than three instances are checked out. If more than three are checked out, an exception is thrown.
This custom pool class is then used in a program which attempts to create more than three instances. The try-catch loop is set up to start checking out instances and to catch exceptions. When an attempt is made to create the fourth instance, an exception is thrown.
Constructor Summary | |
---|---|
PoolTester()
Constructor |
Method Summary | |
---|---|
void |
doTest()
|
static void |
main(java.lang.String[] args)
Provides a main for the PoolTester sample implementation of Application Module Pooling. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PoolTester()
Method Detail |
---|
public void doTest() throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] args)
args
- arguments to the PoolTester sample implementation.
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.7.0) E10653-08 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |