Results 1 to 2 of 2

Thread: Suggestion: Code improvement for LocalSlsbInvokerInterceptor

  1. #1
    Join Date
    Mar 2005
    Location
    Germany
    Posts
    4

    Default 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. #2
    Join Date
    Mar 2005
    Location
    Germany
    Posts
    4

    Default

    Anybody out there? Opinions?

    TIA,

    Andreas

Similar Threads

  1. Replies: 13
    Last Post: Oct 24th, 2007, 10:55 AM
  2. Replies: 4
    Last Post: Jun 20th, 2007, 11:06 AM
  3. Replies: 4
    Last Post: May 12th, 2006, 02:50 AM
  4. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  5. Please help! Unit testing code for JPetStore
    By lakershen in forum Container
    Replies: 4
    Last Post: Jan 13th, 2005, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •