Hi Mariusz,
we encountered the same problem. Our case was a little bit different, but the results were definitely the same (>1500 open connection on the DB).
I think the problem is that the connection will only being returned to the pool, as soon as the continuation object gets destroyed, and that can take some time depending on your configuration. I haven't looked into the code yet, so this is only an assumption.
Hmm, I wonder how it should be related to continuations. In Mariusz code below there is no sendPage(AndWait)() and so no continuation involved.
Perhaps one of the commiters can jump in here and help a little bit. If I have the following flow code, I would assume that the 'schandler' object is not any longer referenced and can be finalized as soon as I set it to 'null'. Unfortunately this will not happen.
Is this a bug, or is there something wrong with the code?
I can't see what's wrong, but I'm not that expert.
var schandler=new Packages.xyz.ClientHandler(getSelectedClients(),connection);
...
schandler=null;
Mariusz Sieraczkiewicz wrote:
I asked the question about getting jdbc connection from flowscript on user mailing list
some time ago, but there was no answer. I started digging, but had some
problems.
I'm having code like this:
//////////////////////
var dbSelector = cocoon.getComponent(Packages.org.apache.avalon.excalibur.datasource.DataSourceComponent.ROLE + "Selector");
try {
var dataSrc = dbSelector.select(srcName);
conn = dataSrc.getConnection();
}
catch (e) {
e.printStackTrace();
}
finally {
if (conn != null) {
conn.close();
conn = null;
}
if (dbSelector != null) {
cocoon.releaseComponent(dbSelector);
dbSelector = null;
}
}
///////////////
Using it I'm experiencing pooled connection out of resources after several calls (page using it just hungs). I'm afraid I'm not realeasing all resources properly. What's wrong?
Joerg
