I know this can be done by JMX console, but I would like to see a solution which is automatic and should flush all the connections irrespective of their status(idle/busy(if busy should be flushed after the task is done))
Write a MBean which will have configurable time period as a property.
This MBean should call flush periodically on the JBossManagedConnectionPool.
First of all My Apologies for not replying for such a long time.
Thanks a lot for the solution. It really helped me a lot.