Announcement Announcement Module
Collapse
No announcement yet.
Suggestion: Code improvement for LocalSlsbInvokerInterceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suggestion: Code improvement for LocalSlsbInvokerInterceptor

    Spring team,

    I would like to suggest a code improvement for org.springframework.ejb.access.LocalSlsbInvokerInt erceptor which would fix the problem already several people (including myself) have run into when trying to use the LocalStatelessSessionProxy on local EJB interfaces (e.g. generated by XDoclet) that happen NOT to implement the POJO business interface directly :? :

    http://forum.springframework.org/viewtopic.php?t=4943
    http://forum.springframework.org/viewtopic.php?p=2071
    http://forum.springframework.org/viewtopic.php?p=569
    http://sourceforge.net/mailarchive/m...msg_id=7104648

    My suggestion is to use the same detection mechanism as already implemented (but only for Remote objects) in org.springframework.remoting.rmi.RmiClientIntercep torUtils.doInvoke(MethodInvocation invocation, Remote stub):

    This means changing the "try" block in LocalSlsbInvokerInterceptor.invoke(MethodInvocatio n invocation) to read like the following:

    Code:
            try {
                ejb = getSessionBeanInstance();
                
                Method method = invocation.getMethod();
                if (method.getDeclaringClass().isInstance(ejb)) {
                    // directly implemented
                    return method.invoke(ejb, invocation.getArguments());
                } else {
                    // not directly implemented
                    Method ejbMethod = ejb.getClass().getMethod(method.getName(), method.getParameterTypes());
                    return ejbMethod.invoke(ejb, invocation.getArguments());
                }
            }
    This will make all these problems go away (of course at the expense of the additional test "method.getDeclaringClass().isInstance(ejb)").

    What do you think? Shall I create a JIRA issue about this?

    Thanks & best regards,

    Andreas

  • #2
    Anybody out there? Opinions?

    TIA,

    Andreas

    Comment

    Working...
    X