Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute a task every year in a Java web application

Tags:

java

time

timer

How to execute a task every year in a web application automatically? Is the Timer class helpful for this? I also heard about Quartz? I registered in their page but it seems not to be free. Thank you for your help.

like image 397
Diego Ramos Avatar asked Oct 19 '25 11:10

Diego Ramos


1 Answers

Quartz is definitely a good option, it is free and opensource and uses the Apache 2.0 License (you don't have to register to download). You can also simply use cron if you are in a *nix environment.

You can also use a java.util.Timer but I would only do so if your use case is extremely trivial and you make sure you restart your Timer correctly based on some type of persistence layer on startup of your web app.

like image 108
Abdullah Jibaly Avatar answered Oct 21 '25 01:10

Abdullah Jibaly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!