Need an easy way to shutdown geotools without having memory leaks

Description

Running tomcat and reloading the a webapp that uses some small parts of geotools results in the following:

SEVERE: The web application ]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Dec 1, 2010 10:35:58 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application (value []) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Dec 1, 2010 10:35:58 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application

We already call:
org.geotools.util.WeakCollectionCleaner.DEFAULT.exit ();
org.geotools.referencing.factory.DeferredAuthorityFactory.exit ();

in a shutdown hook to remove some threads.
There is however no easy way to remove the ThreadLocals.

These classes are also classes that we do not use directly, they are used by geotools internally and
it is quite time consuming to profile and try to figure out what classes that may have a shutdown/remove/cleanup/exit
method and if that method actually works.

Wanted:
One class: org.geotools.util.ShutDownGeoToolsWithoutMemoryLeaks that has a method shutdown() that does all the
neccessary calls to shutdown geotools without memory leaks.

Environment

None

Status

Assignee

Unassigned

Reporter

codehaus

Triage

None

Affects versions

2.7-M3

Priority

High
Configure