Ben:
I use exactly this approach in the Expresso Application Framework that we're
just in the process of releasing as an open-source project - it's one of the
several ways to set up the framework, to use a background thread that sleeps
some user-specified number of seconds, then checks a job queue to see if
there is anything for it to do. One of the things it can be told to do is
trigger an "event", which then sends e-mails to a list of users to tell them
something has happened that they're interested in. I've found that the
sleeping thread doesn't seem to use much in the way of resources. I also
have it configurable to run as a seperate VM, in case the particular
architechture makes that a good idea, but for fairly small sites the thread
seems to work fine.
Have a look at http://www.javacorporate.com/components/expresso/frame.html -
the job queue link & the events link. The javadoc for it is at
http://www.javacorporate.com/javadoc/index.html, and the source will be on
the site within a few days, both as a zip & a public CVS repository.
Mike Nash
Javacorporate Ltd
http://www.javacorporate.com
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's
> Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Ben
> Coppin
> Sent: Friday, August 20, 1999 6:03 AM
> To: [EMAIL PROTECTED]
> Subject: Using servlets for periodic background processes
>
>
> Has anyone investigated the use of servlets to carry out
> periodic tasks? I
> have a servlet through which users can select topics on which
> they want to
> be emailed regularly. I was thinking that it might be neat if
> instead of
> using cron to do this, I had a separate thread in the
> servlet, or perhaps a
> separate servlet periodically wake up and send out emails and
> then go back
> to sleep.
>
> Does this sound like a daft idea, or has someone out there
> already done
> something like this?
>
> Thanks,
>
> Ben
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html