Persistence and the dynamic scheduling system you mentioned are two concepts. The best way to implement your thing is:
Use AOP to achieve persistence, intercept all function operations, and then persist the results of all operations.
Application scenario 1: Users can customize a reminder on the interface, and an email will be sent when the time is up. Users can also modify the triggering time of this reminder.
This implementation mechanism is: Create a task pool, then save the task information, and then use ExecutorService to schedule the operation. Then use this function to intercept the semaphore when the server exits, and persist the task at this time.
Persistence and the dynamic scheduling system you mentioned are two concepts. The best way to implement your thing is:
Use AOP to achieve persistence, intercept all function operations, and then persist the results of all operations.
Application scenario 1: Users can customize a reminder on the interface, and an email will be sent when the time is up. Users can also modify the triggering time of this reminder.
This implementation mechanism is: Create a task pool, then save the task information, and then use ExecutorService to schedule the operation. Then use this function to intercept the semaphore when the server exits, and persist the task at this time.
Runtime.getRuntime().addShutdownHook(new xxxThread());