Details

    • Type: New Feature New Feature
    • Status: New
    • Priority: 2 Major 2 Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: 3.0
    • Component/s: Triggers
    • Labels:
      None
    • Terracotta Target:
      Pending

      Description

      Quartz scheduler does provide the creation of a trigger by cronSchedule like this:

      trigger = newTrigger()
          .withIdentity("trigger3", "group1")
          .startNow()
          .withSchedule(cronSchedule("0 0 15 ? * WED")) // fire every wednesday at 15:00
          .build();
      

      Because it is not possible to represent every recurrence rule of triggers by CronTrigger as described in http://www.quartz-scheduler.org/documentation/quartz-2.1.x/cookbook/BiDailyTrigger it would be nice to have support for rfc2445 format that should cover every possible rule. Please have a look at tools.ietf.org/html/rfc2445#section-4.3.10 for further information.

      Example:

      trigger = newTrigger()
          .withIdentity("trigger3", "group1")
          .startAt(todayAt(15, 0, 0))     //  at 15:00
          .withSchedule(rfcSchedule("RRULE:FREQ=WEEKLY;BYDAY=WE")) // fire every wednesday
          .build();
      

      Concerning persistence of a trigger, it also would be useful to have an export to rfc2445 format.

      1. quartz-rfc5545_20131212.zip
        38 kB
        Olivier Queyrut
      2. quartz-rfc5545_20131212.zip
        38 kB
        Olivier Queyrut
      3. quartz-rfc5545_20131213.zip
        38 kB
        Olivier Queyrut
      4. quartz-rfc5545.zip
        37 kB
        Olivier Queyrut
      5. quartz-rfc5545.zip
        35 kB
        Olivier Queyrut

        Activity

        Hide
        Narayanan Raghuvaran added a comment -

        Olivier
        Here is what I found out, when I deserialize , the vaidateRecurreneRule gets called and then it calls isNumericValueInByDay which calls getDayList which returns a list. It is suppossed to return a empty list, but since dayList is transient now, it is set to null, so we are getting a null pinter exception

        Show
        Narayanan Raghuvaran added a comment - Olivier Here is what I found out, when I deserialize , the vaidateRecurreneRule gets called and then it calls isNumericValueInByDay which calls getDayList which returns a list. It is suppossed to return a empty list, but since dayList is transient now, it is set to null, so we are getting a null pinter exception
        Hide
        Narayanan Raghuvaran added a comment -

        Hi Oliver
        Thanks for your help so far. I fixed the issue. In readObject of RecurrenceRule, I am initializing the collections if they are currently null. This is with your transient keyword fix for byday
        Here is the code
        private void initCollections() {
        if (secondList == null)

        { secondList = new BoundedIntegerList(MIN_SECOND, MAX_SECOND,false); }

        if (minuteList == null)

        { minuteList = new BoundedIntegerList(MIN_MINUTE, MAX_MINUTE,false); }

        if (hourList == null)

        { hourList = new BoundedIntegerList(MIN_HOUR, MAX_HOUR, false); }

        if (dayList == null)

        { dayList = new ArrayList<ByDay>(); }

        if (monthDayList == null)

        { monthDayList = new BoundedIntegerList(MIN_MONTHDAY, MAX_MONTHDAY, true); }

        if (yearDayList == null)

        { yearDayList = new BoundedIntegerList(MIN_YEARDAY, MAX_YEARDAY, true); }

        if (weekNoList == null)

        { weekNoList = new BoundedIntegerList(MIN_WEEKNO, MAX_WEEKNO, true); }

        if (monthList == null)

        { monthList = new BoundedIntegerList(MIN_MONTH, MAX_MONTH, false); }

        if (setPosList == null)

        { setPosList = new BoundedIntegerList(MIN_SETPOS, MAX_SETPOS, true); }

        }

        private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        initCollections();
        try

        { buildRecurrenceRule(recurrenceRuleExpr); }

        catch (ParseException ignore)

        { // never happens }

        }

        Show
        Narayanan Raghuvaran added a comment - Hi Oliver Thanks for your help so far. I fixed the issue. In readObject of RecurrenceRule, I am initializing the collections if they are currently null. This is with your transient keyword fix for byday Here is the code private void initCollections() { if (secondList == null) { secondList = new BoundedIntegerList(MIN_SECOND, MAX_SECOND,false); } if (minuteList == null) { minuteList = new BoundedIntegerList(MIN_MINUTE, MAX_MINUTE,false); } if (hourList == null) { hourList = new BoundedIntegerList(MIN_HOUR, MAX_HOUR, false); } if (dayList == null) { dayList = new ArrayList<ByDay>(); } if (monthDayList == null) { monthDayList = new BoundedIntegerList(MIN_MONTHDAY, MAX_MONTHDAY, true); } if (yearDayList == null) { yearDayList = new BoundedIntegerList(MIN_YEARDAY, MAX_YEARDAY, true); } if (weekNoList == null) { weekNoList = new BoundedIntegerList(MIN_WEEKNO, MAX_WEEKNO, true); } if (monthList == null) { monthList = new BoundedIntegerList(MIN_MONTH, MAX_MONTH, false); } if (setPosList == null) { setPosList = new BoundedIntegerList(MIN_SETPOS, MAX_SETPOS, true); } } private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); initCollections(); try { buildRecurrenceRule(recurrenceRuleExpr); } catch (ParseException ignore) { // never happens } }
        Hide
        Olivier Queyrut added a comment -

        Hi Raghu,
        Thanks a lot for your help debugging the code.

        I have just posted an update of the source code with an extra junit test that verify serialization/deserialization of the RecurrenceRuleTrigger.

        Regards, Olivier

        Show
        Olivier Queyrut added a comment - Hi Raghu, Thanks a lot for your help debugging the code. I have just posted an update of the source code with an extra junit test that verify serialization/deserialization of the RecurrenceRuleTrigger. Regards, Olivier
        Hide
        Chaitra Suresh added a comment -

        Hi,

        There is a getTimesTriggered() on a SimpleTrigger. But I don't see such a method on RecurrenceTrigger. I want to know exactly how many times a recurrence rule trigger fired. Is there a way to find that out?

        Thanks,
        Chaitra

        Show
        Chaitra Suresh added a comment - Hi, There is a getTimesTriggered() on a SimpleTrigger. But I don't see such a method on RecurrenceTrigger. I want to know exactly how many times a recurrence rule trigger fired. Is there a way to find that out? Thanks, Chaitra
        Hide
        Olivier Queyrut added a comment -

        Hi,
        Currently there is no way to get the number of times the trigger has fired. This is probably a feature that lacks... but I can't implement it right now.

        Probably, it would also be useful to extend the RecurrenceRuleTrigger behavior upon a mis-fire situation, such as MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT, MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT, MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT, MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT. This is not so easy to do with the current implementation of RecurrenceRule.

        As soon as I have time, I take a look at it !

        Regards,
        Olivier

        Show
        Olivier Queyrut added a comment - Hi, Currently there is no way to get the number of times the trigger has fired. This is probably a feature that lacks... but I can't implement it right now. Probably, it would also be useful to extend the RecurrenceRuleTrigger behavior upon a mis-fire situation, such as MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT, MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT, MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT, MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT. This is not so easy to do with the current implementation of RecurrenceRule. As soon as I have time, I take a look at it ! Regards, Olivier

          People

          • Assignee:
            James House
            Reporter:
            Philip Weber
          • Votes:
            8 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated: