In this post I am going to show some useful technique that ADF developers and QAs may use in their daily work. I mean the ability to enable and disable application module pooling on-the-fly without redeploying and restarting the application. This can be useful for testing purposes when you are able to quickly enable or disable AM pooling and check how the application works in both cases. There are some issues that you can run into only when the pooling is enabled. So, developing and testing an application with constantly disabled AM pooling doesn't cover all cases.
I believe that not many developers and testers use in their daily life such monster instruments like EM Fusion Middleware Control. Therefore I would propose to include that functionality in the application, certainly for the development and testing purposes only.
In order to implement that nice feature, we have to create our custom implementation of the ApplicationPool interface and register it in the application module configuration. So, our custom ApplicationPool looks like this:
It has an overridden method isAmPoolingEnabled which returns a private valriable member amPoolingEnabled. In order to register this class and make it used by the framework we should go to the application module configuration and specify the class name in the PoolClassName property at the bottom of the properties list:
And when we need to get an instance of our CustomApplicationPoolImpl and setup the value of the amPoolingEnabled variable, we can make use of the oracle.jbo.common.ampool.PoolMgr internal class and do the following:
The sample application for this post requires JDeveloper R2 11.1.2.3.0.
That's it!
I believe that not many developers and testers use in their daily life such monster instruments like EM Fusion Middleware Control. Therefore I would propose to include that functionality in the application, certainly for the development and testing purposes only.
In order to implement that nice feature, we have to create our custom implementation of the ApplicationPool interface and register it in the application module configuration. So, our custom ApplicationPool looks like this:
public class CustomApplicationPoolImpl extends ApplicationPoolImpl { private boolean amPoolingEnabled = true; public CustomApplicationPoolImpl() { super(); } @Override public boolean isAMPoolingEnabled() { return amPoolingEnabled; } public void setAmPoolingEnabled(boolean amPoolingEnabled) { this.amPoolingEnabled = amPoolingEnabled; } }
It has an overridden method isAmPoolingEnabled which returns a private valriable member amPoolingEnabled. In order to register this class and make it used by the framework we should go to the application module configuration and specify the class name in the PoolClassName property at the bottom of the properties list:
And when we need to get an instance of our CustomApplicationPoolImpl and setup the value of the amPoolingEnabled variable, we can make use of the oracle.jbo.common.ampool.PoolMgr internal class and do the following:
public void setAmPooling(boolean value){ CustomApplicationPoolImpl pool = (CustomApplicationPoolImpl)PoolMgr.getInstance(). getResourcePool("com.cs.blog.ampoolappl.model.AppModuleLocal"); pool.setAmPoolingEnabled(value); }
The sample application for this post requires JDeveloper R2 11.1.2.3.0.
That's it!