Subject Re: [Firebird-Java] Shutdown / Join
Author Mark Rotteveel
On Tue, 25 Aug 2015 17:00:57 +0000, "'Steffen Heil (Mailinglisten)'
lists@... [Firebird-Java]" <Firebird-Java@yahoogroups.com>
wrote:
> Hi
>
> I am using org.firebirdsql.pool.FBWrappingDataSource.
> When I stop the pool using dataSource.shutdown(); it will stop, but
the
> IdleRemover thread seems to stay for some time.
> This leads to a warning in tomcat:
>
> WARNING: The web application [ROOT] appears to have started a thread
named
> [Pool //127.0.0.1//opt/database/osiris4.fdb idleRemover] but has failed
to
> stop it. This is very likely to create a memory leak. Stack trace of
> thread:
> java.lang.Thread.sleep(Native Method)
>
org.firebirdsql.pool.PooledConnectionQueue$IdleRemover.run(PooledConnectionQueue.java:571)
> java.lang.Thread.run(Thread.java:745)
>
>
> I suspect that happens because the thread has not stopped yet, but will
do
> so soon (as we had no related memory leaks as far as we know).
> However, I would really like to just wait until that thread stops.
> Is there any other way than reflection to wait for that thread to stop?
Or
> manually stop it?

There is no method to do that, the only option might be to sleep for 500
milliseconds or more (see
https://github.com/FirebirdSQL/jaybird/blob/Branch_2_2/src/pool/org/firebirdsql/pool/PooledConnectionQueue.java#L571
), although that is still no guarantee.

Unless you have a very good reason to stay with it, I'd suggest you move
to a third-party connection pool. This class (and everything else in
org.firebirdsql.pool) is going to be removed in Jaybird 3.0.

Mark