This content has been marked as final.
Show 6 replies
-
1. Re: Can
jaikiran Feb 22, 2008 12:33 AM (in response to vola)My question is if there is any way I can count how many times this exception is thrown inside my J2EE application?
Why would you want to know "how many times" this exception was thrown? -
2. Re: Can
vola Feb 22, 2008 6:42 PM (in response to vola)Because I am working on self-adaptive system. If too many exceptions are thrown, I hope the system can self-adapt to solve the problem by itself.
-
3. Re: Can
vickyk Feb 23, 2008 1:21 AM (in response to vola)"vola" wrote:
Because I am working on self-adaptive system. If too many exceptions are thrown, I hope the system can self-adapt to solve the problem by itself.
Theoritically there can be couple of ways which comes to my mind , but don't do it unless there is not workaround
1) Modify the InternalManagedConnectionPool , have the variable in the Counter which will should be updated here .else { // UPDATE THE COUNTER HERE // we timed out throw new ResourceException("No ManagedConnections available within configured blocking timeout ( " + poolParams.blockingTimeout + " [ms] )"); }
In the InternalManagedConnectionPool$Counter keep getFailedCount()/setFailedCount methods , these should again be exposed through the JbossManagedConnectionPool .
This is trivial change in
http://anonsvn.jboss.org/repos/jbossas/trunk/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
http://anonsvn.jboss.org/repos/jbossas/trunk/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
2) Have a Mbean which will scan the server.log file and check for the occurance of the NoManagedConnection Error .
Or you can direct the error logging to a specific log file , the Mbean will use this log file and change the setting of the Pool on the fly .
But DON't try these options , you should identify the peak load to which pool can be subjected and configure max pool size accordingly .
The pool will shrink if these connections are not used over long time which is configurable (idle-timeout-minutes) , so keeping the high value for the pool will not be the issue , the pool implementation will take care of all . -
4. Re: Can
vickyk Feb 23, 2008 1:27 AM (in response to vola)Another option :
You can keep count of NoManagedConnection error in the application code.
Finally have a custom MBean which will get this count from the application code and then set the min./max pool size on the JbossManagedConnectionPoolMBean . -
-
6. Re: Can
vola Mar 2, 2008 10:41 AM (in response to vola)Ok. Thanks alot for your advice. I will try these. ^^