In my Java EE 7 application I have created a persistent Schedule task that runs every hour. I have used @Schedule annotation.
When this job is called I want to perform some actions on events that have happened from the last hour until NOW. To obtain NOW I use "new Date()".
This @Schedule has the default persistent attribute to "true", which is great because if the server stops during hours I want to perform these tasks when it restarts.
The problem is that, if the server has been stopped during 5 hours, the job will be launched 5 times, but in all of the executions "new Date()" will be executed, and the result will be the same.
Is there any way to retrieve the date when the @Schedule job should have been launched???