• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Automatic Timer creation suing @schedule annotation

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Source:EJB 3.1 Specification


18.2.1.3.9 "Every other hour within the day starting at noon on the 2nd Tuesday of every month."

@Schedule(hour="12/2", dayOfMonth="2nd Tue")

Question 1:Why is it mentioned that timer will run every other hour ?
As per my understanding,The above created timer will run every 2 hr within the day starting at noon on the 2nd Tuesday of every month
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2532
112
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohit,

"every other hour" means "every second".

Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"every other hour" means "every second".


Then shouldn't the Schedule annotation be as:



Question: Why are we using hour="12/2" ?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2532
112
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I meant 2nd, not seconds...

Why are we using hour="12/2" ?

This is because:

For expression x/y, the attribute is constrained to every yth value within the set of allowable values beginning at time x

So, in our example 12/2: every two hours starting at noon

Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic