Thursday, November 18, 2010

Bit #24 - Displaying Application Module Pool Statistics

You can display statistics related to your Application Module Pools by calling dumpPoolStatistics() on a oracle.jbo.common.ampool.ApplicationPool object. You can acquire an ApplicationPool object by calling getResourcePool() on a oracle.jbo.common.ampool.PoolMgr object and specifying the name of the application module pool name. So, how do you get a PoolMgr object? Just call the static PoolMgr.getInstance(). Finally, you can get the pool name by calling getResourcePoolKeys() on the PoolMgr and enumerating the pools managed by the pool manager. Here is an example:

Example:


    // helper to dump pool statistics to log
    private void dumpAMPoolStatistics() {
        // get the pool manager
        PoolMgr poolMgr = PoolMgr.getInstance();
        // get the pools managed
        Enumeration keys = poolMgr.getResourcePoolKeys();
        if (keys != null) {
            if (keys.hasMoreElements()) {
                // may manage many pools, we will get the name of first one managed
                String poolname = (String)keys.nextElement();
                System.out.println("AM pool name: " + poolname);
                // get the AM pool
                ApplicationPool pool =
                    (ApplicationPool)poolMgr.getResourcePool(poolname);
              
                // log AM pool diagnostics
                PrintWriter out = new PrintWriter(System.out, true);
                pool.dumpPoolStatistics(new PrintWriter(out));
                out.flush();
            }
        }
    }


The helper function above, when added to your application module will display - upon calling it, the AM statistics in the log window as it is shown below.



Context:

BC Implementation Class


References:
83. Dump Application Module Pooling Statistics Servlet

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...