tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 63210] Tomcat failing to shutdown if EvictionTimer thread is running
Date Tue, 05 Mar 2019 05:08:09 GMT

--- Comment #12 from ---
(In reply to Mark Thomas from comment #10)
> DBCP2 (actually Pool2) requires explicit shutdown and is documented as such.
> If it is shutdown (via closeMethod="close") then the Evictor thread is
> stopped.
> My current thinking is to set closeMethod="close" if we create a DataSource
> resource using the built-in factory and to do so in such as way that the
> user can override it if they wish. I need to test this works as expected.

I've just built and tested from the git repository source - the implementation
works as you have implemented - it shuts down correctly without the value set,
and fails to shutdown if closeMethod="" is used.

It actually doesn't fix my use case but that is because we implement our own
factory that returns the BasicDataSource. However it does point me to the
correct solution, which is to set the closeMethod="close" in my case (I thought
I had tried this) - which already works with 9.0.16.

I guess the only change that could make this more generic is to test the
actualResource for implementing AutoClosable e.g. something like:

Object actualResource = envCtx.lookup(resource.getName());
+ if (!resource.isCloseMethodConfigured() && actualResource instanceof
AutoCloseable) {
+   resource.setCloseMethod("close");
+ }

You are receiving this mail because:
You are the assignee for the bug.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message