Hello, If u r familiar with JMX, there is a Timer service That does exactly what you want (emit notifications at certain Interval)....
Regards marco -----Original Message----- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Bill Siggelkow Sent: 15 July 2004 14:29 To: [EMAIL PROTECTED] Subject: Re: [OT] Best practice for background service Jan, Bryan's recommendation of Spring and Quartz sounds good though I have not had a chance to work with these yet. If you want to "roll your own" I suggest you look at the java.util.Timer and java.util.TimerTask objects -- they work well for these type of services. See http://java.sun.com/j2se/1.4.2/docs/api/java/util/TimerTask.html. Jan Behrens wrote: > Hi list, > > I am coding an app where I rely on a background service to check regularly > for new mail. I want to instantiate my service component (the one checking > for mail) when the context is loaded and have it running in a background > thread. I have done only very limited coding with threads so far :( > > What I plan to do is to create a controller servlet that is loaded on > startup and that creates instances of all my services. All services extend > Thread and are started by invoking the run() method when the controller > servlet starts. Would that work? How would I then set the intervall on which > my mail service checks for new mail? Could this be done using > sleep(interval)? > > I wonder whether anyone has tips on this for a newbie or if there is such a > thing as a best practice on this. > > TIA, Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]