Seems my git patch is not updated according to my workspace.  refresh it to
the correct one,  sort the methods before use it.


            * @Timeout
              */
             if (bean instanceof TimerConsumer) {
                 TimerConsumer timerConsumer = (TimerConsumer) bean;
                 if (timerConsumer.getTimeoutMethod() == null) {
-                    List<Annotated<Method>> timeoutMethods =
annotationFinder.findMetaAnnotatedMethods(javax.ejb.Timeout.class);
+                    List<Annotated<Method>> timeoutMethods =
sortMethods(annotationFinder.findMetaAnnotatedMethods(javax.ejb.Timeout.class));

                     //Validation Logic is moved to CheckCallback class.
-                    if(timeoutMethods.size() == 1){
-                        timerConsumer.setTimeoutMethod(new
NamedMethod(timeoutMethods.get(0).get()));
+                    if(timeoutMethods.size() >= 1){
+                        // only set the timeout method of child class
because
+                        // the timeout method in child class will override
the timeout method in super classes
+                        timerConsumer.setTimeoutMethod(new
NamedMethod(timeoutMethods.get(timeoutMethods.size()-1).get()));
                     }
                 }
             }

             if (bean instanceof org.apache.openejb.jee.Session) {

On Wed, Apr 13, 2011 at 10:15 AM, Shawn Jiang <[email protected]> wrote:

> Currently,  the code in openejb assume there's only 1 @Timeout annotated
> method within a EJB.   Actually,  when there's multiple @timeout in the
> class inheritance hierarchy.
> The finder would return a method list the size of which is >1.
> Following patch would use the @Timeout method in the bottom class where
> @Timeout is defined.
>
> org.apache.openejb.config.AnnotationDeployer.ProcessAnnotatedBeans.processCallbacks(Lifecycle,
> AnnotationFinder)
> {
>
> .....
>
>  if (bean instanceof TimerConsumer) {
>                  TimerConsumer timerConsumer = (TimerConsumer) bean;
>                  if (timerConsumer.getTimeoutMethod() == null) {
>                      List<Annotated<Method>> timeoutMethods =
> annotationFinder.findMetaAnnotatedMethods(javax.ejb.Timeout.class);
>                      //Validation Logic is moved to CheckCallback class.
> -                    if(timeoutMethods.size() == 1){
> -                        timerConsumer.setTimeoutMethod(new
> NamedMethod(timeoutMethods.get(0).get()));
> +                    if(timeoutMethods.size() >= 1){
> +                        // only set the timeout method of child class
> because
> +                        // the timeout method in child class will override
> the timeout method in superclass
> +                        timerConsumer.setTimeoutMethod(new
> NamedMethod(timeoutMethods.get(timeoutMethods.size()-1).get()));
>                      }
>                  }
>              }
>
> ....
>
> }
>
> Will open a JIRA later for this.
>
>
> --
> Shawn
>



-- 
Shawn

Reply via email to