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

EJB-Timer Implementation is missing / not integrated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 7.0.0.CR1
    • EJB
    • Hide

      Deploy an EJB like this:

      @Singleton
      @Startup
      public class StartupScheduler {
      	
       @Resource
       TimerService timerService;
      
       @PostConstruct
       private void startup() {
        timerService.createIntervalTimer(0, 10*1000, new TimerConfig("hello world #" + new Random().nextInt(), false));
       }
      	
       @Timeout
       public void print() {
        System.out.println(System.currentTimeMillis());
       }
      
       @PreDestroy
       private void shutdown() {
        for(Timer timer : timerService.getTimers()) {
         timer.cancel();
        }
       }
      }
      
      Show
      Deploy an EJB like this: @Singleton @Startup public class StartupScheduler { @Resource TimerService timerService; @PostConstruct private void startup() { timerService.createIntervalTimer(0, 10*1000, new TimerConfig( "hello world #" + new Random().nextInt(), false )); } @Timeout public void print() { System .out.println( System .currentTimeMillis()); } @PreDestroy private void shutdown() { for (Timer timer : timerService.getTimers()) { timer.cancel(); } } }
    • Workaround Exists
    • Hide

      Using quartz or something similar.

      Show
      Using quartz or something similar.

    Description

      EJB-Component is missing an integrated EJB-Timer-Implementation.

      Creating a time from within an EJB gives the following stacktrace:
      ...

      Caused by: java.lang.UnsupportedOperationException: This is a temporary non-functional timerservice. No operations are allowed on it.
              at org.jboss.as.ejb3.component.EJBComponent$NonFunctionalTimerService.<init>(EJBComponent.java:337)
              at org.jboss.as.ejb3.component.EJBComponent$NonFunctionalTimerService.<init>(EJBComponent.java:335)
              at org.jboss.as.ejb3.component.EJBComponent.getTimerService(EJBComponent.java:200)
              at org.jboss.as.ejb3.component.TimerServiceBindingSource$TimerServiceManagedReference.getInstance(TimerServiceBindingSource.java:81)
              at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptor.java:64)
      

      The problem is a missing piece in the EJBComponent.java(line 198):

          public TimerService getTimerService() throws IllegalStateException {
              // TODO: Temporary, till we have a working timerservice integrated
              return new NonFunctionalTimerService();
          }
      

      https://github.com/jbossas/jboss-as/blob/master/ejb3/src/main/java/org/jboss/as/ejb3/component/EJBComponent.java#L198

      Attachments

        Activity

          People

            jaikiran Jaikiran Pai (Inactive)
            SebastianJancke Sebastian Jancke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: