User: oberg   
  Date: 00/10/25 04:08:19

  Modified:    src/main/org/jboss/ejb/plugins/jrmp/server
                        JRMPContainerInvoker.java
  Log:
  Context classloader is now set properly on optimized bean2bean calls.
  This fixes the bug with called bean seeing java:comp/env namespace of caller
  
  Revision  Changes    Path
  1.28      +24 -11    
jboss/src/main/org/jboss/ejb/plugins/jrmp/server/JRMPContainerInvoker.java
  
  Index: JRMPContainerInvoker.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jrmp/server/JRMPContainerInvoker.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- JRMPContainerInvoker.java 2000/10/25 08:31:02     1.27
  +++ JRMPContainerInvoker.java 2000/10/25 11:08:19     1.28
  @@ -72,7 +72,7 @@
    *      @author Rickard �berg ([EMAIL PROTECTED])
    *           @author <a href="mailto:[EMAIL PROTECTED]">Sebastien 
Alborini</a>
    *      @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
  - *      @version $Revision: 1.27 $
  + *      @version $Revision: 1.28 $
    */
   public abstract class JRMPContainerInvoker
      extends RemoteServer
  @@ -190,8 +190,18 @@
            return invokeHome(new MarshalledObject(rmi)).get();
         }
         
  -       return container.invokeHome(new MethodInvocation(null , m, args, tx,
  -        identity, credential));
  +       // Set the right context classloader
  +       ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +       Thread.currentThread().setContextClassLoader(container.getClassLoader());
  + 
  +       try
  +       {
  +          return container.invokeHome(new MethodInvocation(null , m, args, tx,
  +                                         identity, credential));
  +       } finally
  +       {
  +          Thread.currentThread().setContextClassLoader(oldCl);
  +       }
      }
   
      public Object invoke(Object id, Method m, Object[] args, Transaction tx,
  @@ -216,14 +226,17 @@
              return invoke(new MarshalledObject(rmi)).get();
           }
         
  -        // DEBUG
  -//DEBUG           Logger.debug("JRMPCI (local) :invoke "+m.getName());
  -//DEBUG       if (tx != null)
  -//DEBUG                      Logger.debug("Tx is "+tx.toString());
  -//DEBUG       else
  -//DEBUG                      Logger.debug("Tx is null");
  -             //DEBUG
  -       return container.invoke(new MethodInvocation(id, m, args, tx, identity, 
credential));
  +       // Set the right context classloader
  +       ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
  +       Thread.currentThread().setContextClassLoader(container.getClassLoader());
  + 
  +       try
  +       {
  +          return container.invoke(new MethodInvocation(id, m, args, tx, identity, 
credential));
  +       } finally
  +       {
  +          Thread.currentThread().setContextClassLoader(oldCl);
  +       }
      }
   
      // ContainerService implementation -------------------------------
  
  
  

Reply via email to