Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 92660 invoked from network); 10 Jun 2004 13:05:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Jun 2004 13:05:10 -0000 Received: (qmail 65951 invoked by uid 500); 10 Jun 2004 13:04:34 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 65918 invoked by uid 500); 10 Jun 2004 13:04:34 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 65878 invoked by uid 99); 10 Jun 2004 13:04:32 -0000 Received: from [65.54.187.154] (HELO hotmail.com) (65.54.187.154) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 10 Jun 2004 06:04:32 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 10 Jun 2004 06:04:26 -0700 Received: from 128.158.119.4 by by18fd.bay18.hotmail.msn.com with HTTP; Thu, 10 Jun 2004 13:04:26 GMT X-Originating-IP: [128.158.119.4] X-Originating-Email: [coreybaswell@hotmail.com] X-Sender: coreybaswell@hotmail.com From: "Corey Baswell" To: tomcat-user@jakarta.apache.org Bcc: Subject: Re: Spawn New Thread Date: Thu, 10 Jun 2004 08:04:26 -0500 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 10 Jun 2004 13:04:26.0294 (UTC) FILETIME=[75264560:01C44EEB] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Really I nead the thread to be up the lifetime of Tomcat which brings up another question. Right now I start thread in a static block of my servlet class (for example): public class MyServelet ....... static { MyThread myThread = new MyThread(); myThread.setDaemon(true); myThread.start(); } because I know MyServlet will be loaded when Tomcat is. This seems to work but is kind of "goofy" because the thread does not have a direct relationship with the servlet it's just the only place I know to kick it off. Is there a better (or atleast more natural) place to start this thread? Thanks, Corey >From: Tim Funk >Reply-To: "Tomcat Users List" >To: Tomcat Users List >Subject: Re: Spawn New Thread >Date: Wed, 09 Jun 2004 21:16:49 -0400 > >If the thread is associated with a servlet. It would be best to use the >destroy method of the servlet to stop the thread. > >-Tim > >Corey Baswell wrote: > >>Hello, >> >>I'm trying to figure out what the proper way for spawning a new thread in >>Tomcat is. I can create a new thread when my servlet is first loaded, but >>it does not get closed down when tomcat does. Is there anyway to register >>a new thread with Tomcat so that it will get closed when Tomcat goes down? >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org