From users-return-198088-apmail-tomcat-users-archive=tomcat.apache.org@tomcat.apache.org Wed Jun 17 08:39:28 2009 Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 43596 invoked from network); 17 Jun 2009 08:39:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Jun 2009 08:39:28 -0000 Received: (qmail 45630 invoked by uid 500); 17 Jun 2009 08:39:35 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 45566 invoked by uid 500); 17 Jun 2009 08:39:35 -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 45555 invoked by uid 99); 17 Jun 2009 08:39:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 08:39:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of aw@ice-sa.com designates 212.85.38.228 as permitted sender) Received: from [212.85.38.228] (HELO tor.combios.es) (212.85.38.228) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Jun 2009 08:39:26 +0000 Received: from localhost (localhost [127.0.0.1]) by tor.combios.es (Postfix) with ESMTP id B40A6226095 for ; Wed, 17 Jun 2009 10:35:46 +0200 (CEST) Received: from tor.combios.es ([127.0.0.1]) by localhost (tor.combios.es [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u5qMM6CzSXHA for ; Wed, 17 Jun 2009 10:35:46 +0200 (CEST) Received: from [192.168.245.129] (p549EAAED.dip0.t-ipconnect.de [84.158.170.237]) by tor.combios.es (Postfix) with ESMTPA id 6ACCC226081 for ; Wed, 17 Jun 2009 10:35:46 +0200 (CEST) Message-ID: <4A38AB9C.9010702@ice-sa.com> Date: Wed, 17 Jun 2009 10:38:52 +0200 From: =?ISO-8859-1?Q?Andr=E9_Warnier?= Reply-To: aw@ice-sa.com User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Tomcat shutdown problem due to running threads. References: <4A38AA69.6090508@byrman.demon.nl> In-Reply-To: <4A38AA69.6090508@byrman.demon.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org CBy wrote: > O'Reilly's Tomcat The Definitive Guide advises me to invoke the > setDaemon(true) method on any Thread object a web application creates to > keep them from hanging the JVM when Tomcat shuts down. My web service, > however, uses a thread pool that is created via > java.util.concurrent.Executors.newFixedThreadPool(NTHREADS) and I don't > know how to make them daemon threads in this case. > > My new plan was to register a shutdown hook with the JVM in my web > service and to invoke shutdown() or shutdownNow() on the ExecutorService > in it (the method above returns an ExecutorService). Unfortunately, this > does not seem to work. > > Is there another way to be notified when Tomcat shuts down, so I can > shutdown the thread pool accordingly? > From a non-expert (but the expterts are mostly asleep right now) : maybe this ? http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org