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