A little late for the party but nonetheless: I'm using Quartz for something similar. I use a framework that has a startup and shutdown hook. This I where I configure Quartz and launch the thread/worker (in startup hook) and shutting it down nicely (in shutdown hook). This way you don't have to worry about memory leaks when redeploying your webapp. As Tim mentioned you still have to take care of any concurrency between the availability check and the servlets accessing the Wikis though (my worker runs once a day and writes to a database, the webapp servlets then reads from the database).
Med venlig hilsen/Kind regards Casper/Kalle -----Original Message----- From: Tim Watts [mailto:t...@cliftonfarm.org] Sent: 18. maj 2012 21:54 To: Tomcat Users List Subject: Re: Threads in Tomcat On Fri, 2012-05-18 at 12:14 -0400, Vance - wrote: > I'm maintaining a Web application for searching multiple wikis, this > app runs under Tomcat 6. I need to modify a servlet so it instantiates > a 'Thread' subclass to perform a wiki availability check every so > often, say every 30 minutes. Given that I'm no expert on the use of > threads, a co-worker suggested the following questions to look into: > Might want to study the classes & interfaces in java.util.concurrent instead of using a raw Thread. Concurrency often ends up being trickier than it first appears and the classes & interfaces in this package were designed to handle a lot of these subtle details for you. The Executors class in particular has some pre-built common configurations ready to instantiate. > · Does the spawned thread have a time limit imposed by Tomcat? > > · Does it take up worker thread space from other Tomcat threads? > I believe the simple answer to these is No. Which is to say I don't believe Tomcat per se enforces such limits. However, it may be possible that an active SecurityManager could impose them. Would be unusual though -- especially the 1st question. > > I'd appreciate any help anyone could give w.r.t. these questions. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org