I would like my users to be able to choose which days of the week they want to schedule a certain task to run in Java. As I understand, the ScheduledExecutorService is only able to run a single execution, or execute at fixed rates. I am able to run a task every day at a specific time, but haven't figured out how to do that for specific days.
Is there a way to run my task on specific days of the week (eg mon, wed, fri)?
Also, I know that there are 3rd party libraries out there that would do well for what I'm asking, such as Quartz, but I'm wondering if there is a way to do this using only Java APIs.
You can use ScheduledExecutorService
. Please refer below link for details.
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.