Thanks I'll check those things out. Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 709-576-8132 rpower@xxxxxxxxxx http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill Tamas Perlaky <tamas@xxxxxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx 2006/06/21 04:43 PM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> cc Subject Re: Thread question Hi Ron, What you're doing sounds reasonable enough, provided you're not doing this within an EJB container. If it's just a plain web app. you should be fine. You might want to check out the java.util.Timer class to handle the scheduling and thread management for you; it will also make it easy to have your task run at a specific time each day. Also, you'll want to make sure that the servlet this is coordinated from knows to disable the timer (or interrupt your thread for a graceful stop, if you're not using Timer) when your web app is removed (i.e. in the servlet's destroy method). Per Walden's recommendation that you do this task outside of the web app... I'd probably do it as a standalone java app. myself (called from the job scheduler) but I don't think there's anything necessarily wrong with your approach either. The hybrid approach using GetURI is an neat idea and worth considering, but I'm not sure you really gain that much for the extra effort. t. On 21-Jun-06, at 2:34 PM, RPower@xxxxxxxxxx wrote:
I have a need for a web application that I'm writing to do a daily check for expiry dates, and if any meet criteria, to email people notifying them of the expiration coming up. I'm currently creating a thread, then making it sleep for 24 hours and run again. Is this efficient to do? Should I be wary of anything by doing this? Or is there a better way to do it? Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 709-576-8132 rpower@xxxxxxxxxx http://www.stjohns.ca/ ______________________________________________________________________ _____ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill This email communication and accompanying documents is intended only for the individual or entity to which it is addressed and may contain information that is confidential, privileged or exempt from disclosure under applicable law. Any use of this information by individuals or entities other than the intended recipient is strictly prohibited. If you have received this in error, please notify the sender and delete all the copies (electronic or otherwise) immediately. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.