Subject | Re: [Firebird-Java] Connection Pool ?'s |
---|---|
Author | William L. Thomson Jr. |
Post date | 2002-12-02T09:26:58Z |
On Sun, 2002-12-01 at 16:52, David Jencks wrote:
pool with Tomcat I use a servlet to start up the pool. It seems kind of
harsh to have Tomcat kill/destroy that servlet upon stop/restart of
Tomcat.
powers that be agree. I would add it myself, but I have not had good
luck with my own pools in the past, so I am best to stay on the using
end for now. ;)
connection. I have also used finally and really am not sure which one
is better try or finally. Since closing a connection could throw an
exception. What does finally do then?
there was a problem/exception. My try block would catch it. So I am not
sure what's going on.
it under control. Not sure why but I know it's something obvious. I had
it logging a while back, but turned it off.
Thanks though. I will post again if I have further info.
--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone 707.766.9509
Fax 707.766.8989
http://www.obsidian-studios.com
> On 2002.12.01 19:10:58 -0500 William L. Thomson Jr. wrote:I have looked and did not come across anything. In my case when using
> >
> > 1.) How do you close/destroy the pool when you are done? A method or
> > something that would close all connections explicitly and politely, or
> > is it not necessary?
>
> Sorry, I don't remember if thee is such a method. I think I might have
> assumed the connections would all time out eventually.
pool with Tomcat I use a servlet to start up the pool. It seems kind of
harsh to have Tomcat kill/destroy that servlet upon stop/restart of
Tomcat.
> It would be a goodI do not care where, but I would think it to be a useful addition if the
> idea, although not part of the standard DataSource contract.
powers that be agree. I would add it myself, but I have not had good
luck with my own pools in the past, so I am best to stay on the using
end for now. ;)
> >I will play with things and see?
> > 2.) How low can you set the time out without increasing server load
> > during periods of low traffic? While not leaving connections open longer
> > than necessary.
>
> ?? I think you have to measure performance in your situation to decide.
> >basically
> > 3.) How can you be sure a connection was returned. I know I could
> > compare the max connections to the available one, but if for some reason
> > the connection was not returned. What can I do to return it explicitly?
>
> The only way to return a connection to the pool it to close it. When I am
> having problems like this I almost always log each getConnection and
> connection.close and study the logs.
>
> Is all your usage like this?
>
> Connetion c = ds.getConnection();
> //log "I got a connection" + c
> try {
> //do something useful
> }
> finallyExcept here instead of finally I use another try block to close the
> {
> c.close();
> //log "I closed a connection" + c
> }
>
connection. I have also used finally and really am not sure which one
is better try or finally. Since closing a connection could throw an
exception. What does finally do then?
> You absolutely need the finally block. I recommend always getting andI do get and close the connection in the same method.
> closing the connection in the same method to eliminate the possibility of
> not calling the method that returns the connection.
> > So why are my connections not timing out? I can wait over 5 minutes,That's basically what I figured. The connections seem to be closed, if
> > while using a 1 minute timeout and still nothing.
>
> Your connections are not being returned to the pool successfully.
there was a problem/exception. My try block would catch it. So I am not
sure what's going on.
>I will have to do something about the logging again.I can't seem to get
> Again, I strongly recommend logging everything. I've found some really
> tricky problems that way.
it under control. Not sure why but I know it's something obvious. I had
it logging a while back, but turned it off.
Thanks though. I will post again if I have further info.
--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone 707.766.9509
Fax 707.766.8989
http://www.obsidian-studios.com