-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan,

On 8/18/2011 2:38 PM, Dan Armbrust wrote:
> On the plus side, since they never actually remove anything they 
> deprecate... maybe I can just "stop" the thread.  Hmm.

The JVM should not launch more than one AWT thread, so you should be
okay. The only issue would be whether or not it inherits the webapp's
context ClassLoader which would really represent a memory leak if you
do live webapp reloads (or undeploy/redeploy).

You would only get this message if the WebappClassLoader was being
used as the ContextClassLoader for this thread, so that must be the case.

You should be able to trick the AWT thread to start using the system
class loader in a ServletContextListener that looks something like this:

init() {

  Thread myThread = Thread.currentThread();
  ClassLoader ccl = myThread.getContextClassLoader(); // PUSH
  myThread.setContextClassLoader(ClassLoader.getSystemClassLoader());

  // do something that triggers the creation of the AWT -- maybe
  // something like "new java.awt.Frame()"

  myThread.setContextClassLoader(ccl); // POP
}

This will pin the system ClassLoader into memory (big deal) instead of
your webapp's. This should fix this particular leak and, by extension,
remove the error message from your logs.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5NZGkACgkQ9CaO5/Lv0PB6bgCgptx6nHRmbobmlscvujuzaNrL
XAoAnRedjsOD0bPuF9Rv/N1c+4g4w+4p
=rJYz
-----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