http://jcrontab.sourceforge.net
Riaan Oberholzer wrote:
Well, that was part of my question.... if I cannot/don't implement daemon threads to do e.g. automatic daily tasks, what else? E.g, at the end of the day send an e-mail to a (real life) manager with a summary of the day's transactions.... something like that.
Does Tomcat provide some sort of ActionEvent which you can configure to be fired every x milliseconds?
--- Tim Funk <[EMAIL PROTECTED]> wrote:
You can create threads all day in tomcat, but here---------------------------------------------------------------------
are the importnatn things to consider:
- WHY! Are threads really the correct solution?
- If you create threads - what are their scope?
Daemon, non-daemon?
- If you create non-daemon threads - be prepared for
the consequences such as the JVM not going away on tomcat shutdown unless you
have taken the needed precautions.
- If you create dameon only threads, be prepared for
when tomcat shuts down and your daemon still has work to do because the JVM
could exit before your thread is ready to complete its unit of work
- WHY! Are threads really the correct solution?
- And last but not least: WHY! Are threads really
the correct solution?
-Tim
Riaan Oberholzer wrote:
I've mainly worked in BEA WebLogic before and fromnot
colleagues and other sources I have heard it is
recommended (and sometimes not allowed, some evenIndeed,
said) to create threads in your application.
when the application went live in a multi-serverremove
clustered environment, we got very inconsistent
results because of the threads, so we had to
them.are
Question is, how safe is it to create threads in a
Tomcat web-app? I would assume "worker" threads
ok, i.e. threads you create to do a specific taskand
then it terminates. When you are guaranteed thethread
will terminate either because of an error orbecause
the assigned task has been completed.that
But what about "monitor" threads, i.e. threads
does a Thread.sleep(x) for an hour, check someyou
condition and goes back to sleep... some mechanism
implement to e.g. do a task on ahourly/daily/weekly
base. You'd create the thread (and keep a handleto
it) in either an InitServlet.init() and thenor
Thread.interrupt() in the InitServlet.destroy(),
you can do it in an ApplicationListener (somethingthe
like that) class which I think you can define in
web.xml.
How else can you implement that (monitoring) in
Tomcat?
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
--------------------------------------------------------------------- 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]