Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call function periodically in Java

we need run one function periodically in Java web application . How to call function of some class periodically ? Is there any way that call function when some event occured like high load in server and so on . what is crontab ? Is that work periodically ?

like image 332
Sajad Bahmani Avatar asked Nov 18 '09 13:11

Sajad Bahmani


2 Answers

To call something periodically, see TimerTask

like image 172
Brian Agnew Avatar answered Sep 24 '22 23:09

Brian Agnew


If you need something more robust you can use Quartz

As for crontab is the scheduling tool on Unix machines.

like image 25
OscarRyz Avatar answered Sep 24 '22 23:09

OscarRyz