In my Java EE 7 application, I created a persistent Schedule task that runs every hour. I used the @Schedule annotation.
When this task is called up, I want to perform some actions on events that have occurred from the last hour until NOW. To get NOW, I use "new date ()".
This @Schedule has a constant default attribute of βtrueβ, which is great because if the server stops for several hours, I want to perform these tasks on restart.
The problem is that if the server was stopped within 5 hours, the task will be started 5 times, but in all executions the βnew date ()β will be executed, and the result will be the same.
Is there any way to get the date when the @Schedule task was supposed to be launched ???
source share