we need to run one function periodically in a Java web application. How to periodically call a function of a class? Is there a way that calls the function when some event occurred as a high load on the server and so on. What is crontab? Is this periodic work?
To call something periodically, see TimerTask
If you need something more reliable, you can use Quartz
As for crontab, this is a planning tool on Unix machines.
crontab
, , . , . (, Tivoli OpenView), "", , () JMS, .
, , , . beahviour , .
-, -. . cron , Unix- . Windows .
cron
- Java
(1) , (web.xml), .
?
(2) Timer .
- ..
(3) , , Java, - ( ..) .
crontab , Java JVM, : JVM.
java.util.concurrent - , . ScheduledThreadPoolExecutor, .
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/package-summary.html
Java 1.4: http://backport-jsr166.sourceforge.net.
Spring, , Spring - @Scheduled @Async , , :
http://blog.springsource.com/2010/01/05/task-scheduling-simplifications-in-spring-3-0/
, , cron Spring, , Java EE - ( , , ).
: Timer, Java cron, cron4j, Quartz EJB Timer API. : , , ..
, , - , , ..
, JMX . , .