Subject RE: [Firebird-Java] Re: Tomcat contexts and pooled connections
Author Natal Vande Casteele
Hello,

> You should try to call System.gc() after context reloading to prove my
> statement (or prove the opposite). Note, calling System.gc() does
> _not_ guarantee you that garbage collection will be done, but usually
> GC agrees with user and does the garbage collection. :)

Adding the System.gc() call does not free the connections. It might be
the case though that, as you've noted, the garbage collection is not
really executed.

I'm not entirely sure what the 'reload' command of the Tomcat manager
does. From what I can tell, the classes are reloaded but the
constructors don't seem to be called. I keep a static pointer to my
FBWrappingDataSource which if it is equal to null, tells me that I need
to construct my connection pool (this happens on the first call to the
servlet -- all subsequent calls use the constructed pool). Apparently,
the pointer is nullified on a reload, causing the FBWrappingDataSource
to be reconstructed and not cleaning up the old one.

Greetings,
Natal Vande Casteele
Software Engineer
Pocket and Soul


-----Original Message-----
From: Roman Rokytskyy [mailto:rrokytskyy@...]
Sent: Tuesday, June 17, 2003 7:00 PM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] Re: Tomcat contexts and pooled connections

Hi,

> Is there a way to return the database connections to the pool when the
> servlet context is reloaded? I presume they're removed from memory and
> reloaded but different from restarting the tomcat server, the
> connections aren't returned.

In theory, if no hard reference on both connection and connection pool
exist, it will be garbage collected. This in turn means that after
some time connections will be closed.

You should try to call System.gc() after context reloading to prove my
statement (or prove the opposite). Note, calling System.gc() does
_not_ guarantee you that garbage collection will be done, but usually
GC agrees with user and does the garbage collection. :)

Best regards,
Roman Rokytskyy



Yahoo! Groups Sponsor



To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.