glassfish
  1. glassfish
  2. GLASSFISH-16305

Interceptor Bindings are not working with @Schedule methods

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 4.0
    • Component/s: cdi
    • Labels:
      None
    • Environment:

      Windows XP SP2

      Description

      I try to use an interceptor Binding around an @Schedule-annotated method but the interceptor linked to the interceptor binding for this method is never invoked. (see. http://www.java.net/forum/topic/glassfish/glassfish/glassfish-31-interceptor-bindings-schedule)

      The same interceptor binding and interceptor works fine with @Timeout annotated method.

      The intercetor Binding and interceptor works fine when declared in ejb-jar.xml but not with annotations.

      In attachment please find the code sample I use to test it under glassfish v3.1.

        Activity

        Hide
        marina vatkina added a comment -

        This seems like a CDI processing or CDI integration issue. Transferring to CDI team for further investigation.

        Show
        marina vatkina added a comment - This seems like a CDI processing or CDI integration issue. Transferring to CDI team for further investigation.
        Hide
        arjavdesai added a comment -

        Test EJB had a few error e.g. it was using javax.ejb.Resource instead of javax.annotation.Resource. Also, there was no Interceptor defined around, @Schedule method. So, I changed the code as

        ....

        @Singleton
        public class Test implements Serializable {

        private static final long serialVersionUID = -254310325908151372L;
        @javax.annotation.Resource
        TimerService timerService;

        @Schedule(second = "/5", minute = "", hour = "*")
        @Interceptors(MetrologyBean.class)
        void schedule()

        { System.out.println("schedule()"); }

        ....

        On once the app is deployed, I can see the Interceptor being invoked and server log has:

        [2013-04-09T16:44:10.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=189 _ThreadName=Thread-3] [timeMillis: 1365540250001] [levelValue: 800] [[
        aroundTimeout of method schedule]]

        [2013-04-09T16:44:10.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=189 _ThreadName=Thread-3] [timeMillis: 1365540250001] [levelValue: 800] [[
        schedule()]]

        [2013-04-09T16:44:15.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=190 _ThreadName=Thread-3] [timeMillis: 1365540255001] [levelValue: 800] [[
        aroundTimeout of method schedule]]

        [2013-04-09T16:44:15.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=190 _ThreadName=Thread-3] [timeMillis: 1365540255001] [levelValue: 800] [[
        schedule()]]

        Fwiw, I have glassfish built at revision # 61246 from reop https://svn.java.net/svn/glassfish~svn/trunk/main/appserver

        Show
        arjavdesai added a comment - Test EJB had a few error e.g. it was using javax.ejb.Resource instead of javax.annotation.Resource. Also, there was no Interceptor defined around, @Schedule method. So, I changed the code as .... @Singleton public class Test implements Serializable { private static final long serialVersionUID = -254310325908151372L; @javax.annotation.Resource TimerService timerService; @Schedule(second = " /5", minute = " ", hour = "*") @Interceptors(MetrologyBean.class) void schedule() { System.out.println("schedule()"); } .... On once the app is deployed, I can see the Interceptor being invoked and server log has: [2013-04-09T16:44:10.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=189 _ThreadName=Thread-3] [timeMillis: 1365540250001] [levelValue: 800] [[ aroundTimeout of method schedule]] [2013-04-09T16:44:10.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=189 _ThreadName=Thread-3] [timeMillis: 1365540250001] [levelValue: 800] [[ schedule()]] [2013-04-09T16:44:15.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=190 _ThreadName=Thread-3] [timeMillis: 1365540255001] [levelValue: 800] [[ aroundTimeout of method schedule]] [2013-04-09T16:44:15.001-0400] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=190 _ThreadName=Thread-3] [timeMillis: 1365540255001] [levelValue: 800] [[ schedule()]] Fwiw, I have glassfish built at revision # 61246 from reop https://svn.java.net/svn/glassfish~svn/trunk/main/appserver
        Hide
        marina vatkina added a comment -

        The bug is not about use of interceptor binding, not @Interceptors annotation. Does it work if @Metrology is specified on the bean or @Schedule annotated method?

        Show
        marina vatkina added a comment - The bug is not about use of interceptor binding, not @Interceptors annotation. Does it work if @Metrology is specified on the bean or @Schedule annotated method?
        Hide
        arjavdesai added a comment -

        I don't see interceptor being called, if @Metrology is specified on the bean or @Schedule annotated method.

        I do interceptor being called, if @Interceptors(MetrologyBean.class) is specified on the bean or @Schedule annotated method.

        Does this mean, bug is not resolved i.e. should it work with @Metrology?

        Show
        arjavdesai added a comment - I don't see interceptor being called, if @Metrology is specified on the bean or @Schedule annotated method. I do interceptor being called, if @Interceptors(MetrologyBean.class) is specified on the bean or @Schedule annotated method. Does this mean, bug is not resolved i.e. should it work with @Metrology?
        Hide
        arjavdesai added a comment -

        I just read-up on it and it seems @Metrology should work as well. I had not added in past but added interceptor definition in beans.xml now. This doesn't change/fix the issue either, so re-opening for further triage.

        Show
        arjavdesai added a comment - I just read-up on it and it seems @Metrology should work as well. I had not added in past but added interceptor definition in beans.xml now. This doesn't change/fix the issue either, so re-opening for further triage.
        Hide
        arjavdesai added a comment -

        revision 61414 should fix it.

        Show
        arjavdesai added a comment - revision 61414 should fix it.

          People

          • Assignee:
            arjavdesai
            Reporter:
            Sergio
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: