-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ravi,

On 7/10/2009 10:32 PM, Ravi Sharma wrote:
> I need to run some threads at particular time during the day, does Tomcat
> provide any such facility? If not then whats the other best way to go for
> it.

Other than webapp-oriented options, I'd like to remind you (and others)
that any decent server OS has the ability to schedule jobs outside of
any request-oriented server like Tomcat.

Consider using cron on *NIX or the Task Scheduler on Windows or
whatever. You can still write your code in Java is you want.

I just find that running scheduled jobs from a webapp to be
inappropriate at best and inconvenient and unreliable at worst.
Schedulers such as cron have the ability to run jobs at strange
intervals (such as every day, but only on weekdays), to run jobs missed
during system downtime, etc.

> Basically i recalculate my site's visitor data every 30 minute and keep in
> cahce and then display to users, 30 minute delay for my data is fine but
> atleast i dont need to run queries to find those data for each request. Now
> every 30 minute i want to run those query and update the cache. How can i
> achive it.?

You could write a component that updates visitor data on demand at
intervals instead of proactively scheduling it: it's just an expiring
cache. Your component returns the cached data unless some time limit has
been exceeded, at which point all clients wait while the new set of
visitor data is loaded into the cache.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkpY9d4ACgkQ9CaO5/Lv0PC/vACgiHAiV9InIcNcHtIbgszTZ6qm
ZY4An26rZiSGInknLAJjzCToU9WqTf0L
=/oX1
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to