-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 3/21/18 10:33 AM, Mark Thomas wrote:
> On 21/03/18 13:50, Christopher Schultz wrote:
> 
> <snip/>
> 
>> Hmm, I'll take a look at that.
>> 
>> This Listener predates a lot of Tomcat's more recent
>> capabilities. I know that there is a tension between the
>> officially-documented behavior of JNDI DataSources (you always
>> get a new DataSource) and what webapps usually do (always go to
>> JNDI to get the DataSource) and so Tomcat has options by default
>> that re-issue the same DataSource to code.
>> 
>> It used to be that failing to dispose of the DataSource left it 
>> hanging around. That seemed unclean to me, so I wrote the 
>> ServletContextListener to shut it down cleanly.
> 
> I'm sure that was the case a while ago. Probably far enough back
> that it was before all the work on memory leak detection and
> prevention.

Okay, I already had closeMethod="close" set. I just need to set up a
test-case where I can check to see if it's actually doing it. Perhaps
I can just throw-out my ServletContextListener.

I should be able to:

0. Disable my Listener
1. Launch Tomcat + my webapp
2. Stop/undeploy my webapp
3. Check via JMX to see if the DataSource has shut down

If that works, I can just remove my listener.

>> My JDBC library is in Tomcat's lib/ directory for a handful of
>> reasons (not the least of which is that Connector/J team can't
>> seem to figure out how to let client code shut down the Threads
>> it creates -- stupidly I might add). Does that impact whether or
>> not Tomcat will auto-close the DataSource?
> 
> That should make no difference.

Okay.

Once I figure out whether the DataSource is being shut down, I think
I'd like to bundle the JDBC driver in the web application instead of
always having to drop it into CATALINA_HOME (or CATALINA_BASE). That
then allows me to whitelist a specific JDBC connection under the
SecurityManager instead of giving the JDBC driver AllPermission :)

>> The <Resource> itself is defined in the application's 
>> META-INF/context.xml file and nowhere else. How does that impact
>> things?
> 
> That is a requirement. It has to be defined in the app to be
> stopped when the app stops.

Good. No problem, here.

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqyiAAdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFjthg/9HO/TvVkgrcAPbC0w
b/al/d1Vycew6tG9luBI4lEdtU9jfNcGKBYGBB6XmcY9cs70YHQgS82P4HC6DJ3K
n9gHgqxRErfF17seFY6VWRnZpmfeUCOmtbsYvDy3YHHdN1bBNmlxsgbP8mIsLiMM
3k3U42fbd658pxVrcV37pozoqJUeNArDKuu3pGNg4a1MXbeSnE+uQupJoTNAANre
KSceymw4KGxhlzEpdGiME9eWjctpY9gzGJeZ12qKqAX8uaiesLTRX+d/kE6PnOlG
EGHWOHI0cpYMbWMAKSHiPzbS8Bvk9f33uZ6fwj9uTrNOfH9IaCchTAAQENkwyyhY
a+b0sZfeD1dr4GiN0S/NvHLat51YncRBjUmcxrGdP8rUjEAON1GGkgaBtlFtX8WM
3Av4xB984BzsmMOtzKmY+omeo5ZXQfpVbwSjMoEVSzYlnhv9qzY8ezK3csLzC9s2
o3T3tNjzZsdTXoLjIPtsNQmSrXUUkosYYGORBoIVRztYxIimiCTUtWl+PV6f9fIA
H56qietpt/xooUHdQ99Tc9KJOqmMOM0lo0fl20zu6hWaSu/FCRUJPaAgkti68WxX
prQPye92TcjfOM1OEnOAMkpWUjPQ+l8y3Qk3IUKkmSqmOH3kGUBeCLILZHasNi9Q
auFSh9aJ12+xMZZzrWzCkzpksWY=
=ijRt
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to