I have created a scheduler using EJB 3.1 timee and schedulerd to execute at 22:30pm on week days. The annotation is given below:
@Schedule(minute="30", hour="22", dayOfWeek="5–1")
But I found that this scheduler executed immediately after starting the wildfly application server even if it is not the scheduled time.
Thanks!
I do not know exact circumstances when your server is restarted, but in case when e.g. server is shut down at 22.20 and started up at 22.35 then container is obliged to fire callback method for persistent timers after restart. As specification says (18.4.3):
Any interval persistent timers or schedule based persistent timers that have expired during the intervening time must cause the corresponding timeout callback method to be invoked at least once upon restart.
You use persistent timer so server restart during timer expiration could be the root cause of execution callback immediately after start up.