Author: xuhaihong
Date: Wed Apr 13 05:55:26 2011
New Revision: 1091658
URL: http://svn.apache.org/viewvc?rev=1091658&view=rev
Log:
OPENEJB-1521 Openejb assume there's only 1 @Timeout annotated method within EJB
inheritance hierarchy. (Patch from Shawn Jiang)
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1091658&r1=1091657&r2=1091658&view=diff
==============================================================================
---
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
(original)
+++
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
Wed Apr 13 05:55:26 2011
@@ -2199,10 +2199,12 @@ public class AnnotationDeployer implemen
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){
+ // Use the timeout method most near the 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()));
}
}
}