Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-2032

EJB Timer Service - cannot cancel configured calendar timer.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.CR1
    • 7.0.2.Final
    • EJB
    • None
    • Hide

      configure a calendar timer, let it trigger the callback and try to cancel it afterwards.

      Show
      configure a calendar timer, let it trigger the callback and try to cancel it afterwards.

      // Timer configuration
      private String payload = "This is the payload passed to the timer event";
      ScheduleExpression schedule = new ScheduleExpression().second(30).minute("").hour("").dayOfMonth("").dayOfWeek("").month("").year("");
      private Timer timer = timerService.createCalendarTimer(schedule, new TimerConfig(payload, true));
      ...
      timer.cancel(); // -> doesn't work!

      Collection<Timer> timers = timerService.getTimers();
      System.out.println("Timers configured: " + timers); // still reports the timer

      // Callback configuration
      @SuppressWarnings("unused")
      @Timeout
      private void configurationScheduledTimeout(final Timer t) {
      String info = (String) t.getInfo();
      System.out.println("configurationScheduledTimeout called at: " + new java.util.Date() + "info: " + info);
      }

      Cancel from within configurationScheduledTimeout also didn't work.

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              awuttke_jira Andreas Wuttke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: