Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 64E1A8F9A for ; Thu, 18 Aug 2011 19:14:22 +0000 (UTC) Received: (qmail 82547 invoked by uid 500); 18 Aug 2011 19:14:18 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 82327 invoked by uid 500); 18 Aug 2011 19:14:17 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 82318 invoked by uid 99); 18 Aug 2011 19:14:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 19:14:17 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [76.96.62.16] (HELO qmta01.westchester.pa.mail.comcast.net) (76.96.62.16) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 19:14:08 +0000 Received: from omta18.westchester.pa.mail.comcast.net ([76.96.62.90]) by qmta01.westchester.pa.mail.comcast.net with comcast id Mv1b1h00M1wpRvQ51vDoaD; Thu, 18 Aug 2011 19:13:48 +0000 Received: from [192.168.1.201] ([69.143.109.145]) by omta18.westchester.pa.mail.comcast.net with comcast id MvDi1h00d38FjT13evDmxk; Thu, 18 Aug 2011 19:13:46 +0000 Message-ID: <4E4D6469.5090500@christopherschultz.net> Date: Thu, 18 Aug 2011 15:13:45 -0400 From: Christopher Schultz User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: How to handle the AWT-Windows thread? References: <4E4D57B6.5090008@apache.org> In-Reply-To: X-Enigmail-Version: 1.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org -----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-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org