eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
385 stars 143 forks source link

Interceptor Bindings are not working with @Schedule methods #16305

Closed glassfishrobot closed 11 years ago

glassfishrobot commented 13 years ago

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.

Environment

Windows XP SP2

Affected Versions

[3.1]

glassfishrobot commented 6 years ago
glassfishrobot commented 12 years ago

@glassfishrobot Commented mvatkina said: This seems like a CDI processing or CDI integration issue. Transferring to CDI team for further investigation.

glassfishrobot commented 11 years ago

@glassfishrobot Commented @arjav-desai said: 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

glassfishrobot commented 11 years ago

@glassfishrobot Commented mvatkina said: 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?

glassfishrobot commented 11 years ago

@glassfishrobot Commented @arjav-desai said: 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?

glassfishrobot commented 11 years ago

@glassfishrobot Commented @arjav-desai said: 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.

glassfishrobot commented 11 years ago

@glassfishrobot Commented @arjav-desai said: revision 61414 should fix it.

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: javaee6.zip Attached By: sergiomail

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-16305

glassfishrobot commented 13 years ago

@glassfishrobot Commented Reported by sergiomail

glassfishrobot commented 11 years ago

@glassfishrobot Commented Marked as fixed on Saturday, April 13th 2013, 4:14:34 am