[jboss-jira] [JBoss JIRA] (WFLY-4558) Use "increment" @Schedule for minute require specify hour, for second require specify hour and minute
Stuart Douglas (JIRA)
issues at jboss.org
Mon Apr 27 01:22:52 EDT 2015
[ https://issues.jboss.org/browse/WFLY-4558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stuart Douglas resolved WFLY-4558.
----------------------------------
Resolution: Rejected
If you look in the javadocs for @Schedule (which is also part of the spec) you will see that the hour() field is defined with a default of "0" rather than "*", which I agree is not particularly intuitive, however we can't go against the spec.
> Use "increment" @Schedule for minute require specify hour, for second require specify hour and minute
> -----------------------------------------------------------------------------------------------------
>
> Key: WFLY-4558
> URL: https://issues.jboss.org/browse/WFLY-4558
> Project: WildFly
> Issue Type: Bug
> Components: EJB
> Affects Versions: 8.2.0.Final
> Reporter: Matteo Mortari
> Priority: Minor
> Attachments: 20150425.WFLY-4558.zip
>
>
> I will attach reproducer and from my perspective workaround exists.
> If I {{@Schedule}} like this
> {code}
> @Schedule(minute="*/1", persistent=false) // NOT working.
> {code}
> is not working.
> But if I do like this:
> {code}
> @Schedule(hour="*", minute="*/1", persistent=false) // this works OK.
> {code}
> it works.
> In the specs (1) there is no mention that if I schedule using "Increments" option do I need to specify any of the other elements, because in general _All elements of this annotation are optional._
> The problem is applying analogously if using "Increments" option for the {{second}} element, you need to specifiy {{hour}} and {{minute}} to have it working.
> So, while I anyway in my perspective workaround exists - specify star {{"*"}} for hour or minute-and-hour for setting increments at minute or second respectively - I believe this behavior was not fully adherent to the specs and worth notifying, also I've taken liberty not to leave this jira priority as high, which was by default =)
> The attached reproducer should be self-explanatory, the most important is the EJB being scheduled:
> {code}
> @Schedule(minute="*/1", persistent=false)
> public void settingJustMinute() {
> LOG.info("settingJustMinute() : invoked."); // NOT working
> }
> @Schedule(hour="*", minute="*/1", persistent=false)
> public void settingEveryMinuteStarHour() {
> LOG.info("settingEveryMinuteStarHour() : invoked."); // is working OK.
> }
> @Schedule(second="*/1", persistent=false)
> public void settingJustSecond() {
> LOG.info("settingJustSecond() : invoked."); // NOT working
> }
> @Schedule(minute="*", second="*/1", persistent=false)
> public void settingEverySecondStarMinute() {
> LOG.info("settingEverySecondStarMinute() : invoked."); // NOT working
> }
> @Schedule(hour="*", second="*/1", persistent=false)
> public void settingEverySecondStarHour() {
> LOG.info("settingEverySecondStarHour() : invoked."); // NOT working
> }
> @Schedule(hour="*", minute="*", second="*/1", persistent=false)
> public void settingEverySecondStarMinuteStarHour() {
> LOG.info("settingEverySecondStarMinuteStarHour() : invoked."); // is working OK.
> }
> {code}
> Hope this helps,
> Thank you
> Ciao
> (1) https://docs.oracle.com/javaee/7/api/javax/ejb/Schedule.html
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list