What is the best solution to perform scheduled tasks in Java, whatever the OS?

后端 未结 5 1419
遥遥无期
遥遥无期 2021-02-04 16:31

I\'d like to generate alarms on my Java desktop application :

  • alarms set with a specific date/time which can be in 5 minutes or 5 months
  • I need to be able
5条回答
  •  迷失自我
    2021-02-04 17:30

    Of the available options you have listed, IMHO Option 3 is better. As you are looking only for an external trigger to execute the application, CRON or Scheduled tasks are better solutions than other options you have listed. By this way, you remove a complexity from your application and also your application need not be running always. It could be triggered externally and when the execution is over, your application will stop. Hence, unnecessary resource consumption is avoided.

提交回复
热议问题