2 Replies Latest reply: Mar 30, 2012 4:58 PM by Andreas Hess RSS

@interceptors for @schedule

Andreas Hess Newbie

Hi

 

I have a EJB with a scheduled function. I'm not sure, but I think interceptors should work on @scheduled functions as well, but they don't.

 

Sample code (interceptor is NOT called):

 

@Singleton

@LocalBean

public class MySchedule

{

  @Schedule(persistent = false, hour = "*", minute = "*", second = "*/10")

  @Interceptors({ MyInterceptor.class })

          void runSampel()

          {

                    // something

          }

}

 

Sample code (interceptor IS called):

 

@Singleton

@LocalBean

public class MySchedule

{

   @Resource

   private SessionContext context;

 

  @Interceptors({ MyInterceptor.class })

  void runFunction()

          {

                         // something

          }

 

  @Schedule(persistent = false, hour = "*", minute = "*", second = "*/10")

     void runSampel()

     {

        context.getBusinessObject(getClass()).runFunction();

     }

}

 

Is this a bug or am I doing something wrong?