Thanks to all for their answers,

I think I will look into doing this with java.util.Timer & TimerTask for now
and keep Spring and Quartz in mind to be looked at later. I now that it
usually takes quite a bit of time to get to terms with a new framework (for
me that is, of course) and I just can't spare the time right now.

Cheers & thanks again.

Jan

-----Original Message-----
From: Daniel Perry [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 15, 2004 3:48 PM
To: Struts Users Mailing List
Subject: RE: [OT] Best practice for background service


Quartz is very easy to use.  No need for thread programming.

But "Job" classes are created as and when they are needed (so no
initialisation and shared object).

Create a struts plug-in which initialises quartz, and sets up the jobs (very
little code needed).

Daniel.

> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] 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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to