just FYI, with the new CL we don't need the set on every call at least for
class visibility.  We do need it to make sure that guys we call and that
don't behave right with the CL don't mess up the CL for other people.

marcf

|-----Original Message-----
|From: [EMAIL PROTECTED]
|[mailto:[EMAIL PROTECTED]]On Behalf Of Scott
|M Stark
|Sent: Thursday, February 14, 2002 4:17 PM
|To: [EMAIL PROTECTED]
|Subject: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb
|EntityContainer.java MessageDrivenContainer.java
|StatefulSessionContainer.java StatelessSessionContainer.java
|
|
|  User: starksm
|  Date: 02/02/14 16:17:28
|
|  Modified:    src/main/org/jboss/ejb EntityContainer.java
|                        MessageDrivenContainer.java
|                        StatefulSessionContainer.java
|                        StatelessSessionContainer.java
|  Log:
|  Fix improper usage of setContextClassLoader without a try/finally
|  block to restore the original class loader.
|
|  Revision  Changes    Path
|  1.67      +142 -121  jboss/src/main/org/jboss/ejb/EntityContainer.java
|
|  Index: EntityContainer.java
|  ===================================================================
|  RCS file:
|/cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v
|  retrieving revision 1.66
|  retrieving revision 1.67
|  diff -u -r1.66 -r1.67
|  --- EntityContainer.java     13 Feb 2002 02:35:08 -0000      1.66
|  +++ EntityContainer.java     15 Feb 2002 00:17:28 -0000      1.67
|  @@ -62,7 +62,7 @@
|   * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel OConnor</a>
|   * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
|   * @author <a
|href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
|  -* @version $Revision: 1.66 $
|  +* @version $Revision: 1.67 $
|   *
|   * <p><b>Revisions:</b>
|   *
|  @@ -295,49 +295,55 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Acquire classes from CL
|  -      if (metaData.getHome() != null)
|  -         homeInterface = classLoader.loadClass(metaData.getHome());
|  -      if (metaData.getRemote() != null)
|  -         remoteInterface = classLoader.loadClass(metaData.getRemote());
|  -
|  -      // Call default init
|  -      super.create();
|  -
|  -      // Map the bean methods
|  -      setupBeanMapping();
|  -
|  -      // Map the home methods
|  -      setupHomeMapping();
|  -
|  -      // Map the interfaces to Long
|  -      setupMarshalledInvocationMapping();
|  -
|  -      // Initialize pool
|  -      instancePool.create();
|  -
|  -      // Init container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.create();
|  -
|  -      // Init instance cache
|  -      instanceCache.create();
|  -
|  -      // Init persistence
|  -      persistenceManager.create();
|  -
|  -      // Initialize the interceptor by calling the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  -      {
|  -         in.setContainer(this);
|  -         in.create();
|  -         in = in.getNext();
|  -      }
|  -      readOnly = ((EntityMetaData)metaData).isReadOnly();
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|  +
|  +      try
|  +      {
|  +         // Acquire classes from CL
|  +         if (metaData.getHome() != null)
|  +            homeInterface = classLoader.loadClass(metaData.getHome());
|  +         if (metaData.getRemote() != null)
|  +            remoteInterface =
|classLoader.loadClass(metaData.getRemote());
|  +
|  +         // Call default init
|  +         super.create();
|  +
|  +         // Map the bean methods
|  +         setupBeanMapping();
|  +
|  +         // Map the home methods
|  +         setupHomeMapping();
|  +
|  +         // Map the interfaces to Long
|  +         setupMarshalledInvocationMapping();
|  +
|  +         // Initialize pool
|  +         instancePool.create();
|  +
|  +         // Init container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.create();
|  +
|  +         // Init instance cache
|  +         instanceCache.create();
|  +
|  +         // Init persistence
|  +         persistenceManager.create();
|  +
|  +         // Initialize the interceptor by calling the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.setContainer(this);
|  +            in.create();
|  +            in = in.getNext();
|  +         }
|  +         readOnly = ((EntityMetaData)metaData).isReadOnly();
|  +      }
|  +      finally
|  +      {
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|  +      }
|      }
|
|      public void start() throws Exception
|  @@ -345,67 +351,77 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default start
|  -      super.start();
|  -
|  -      // Start container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.start();
|  -
|  -      // Start instance cache
|  -      instanceCache.start();
|  -
|  -      // Start persistence
|  -      persistenceManager.start();
|  -
|  -      // Start the instance pool
|  -      instancePool.start();
|  -
|  -      // Start all interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|  +      {
|  +         // Call default start
|  +         super.start();
|  +
|  +         // Start container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.start();
|  +
|  +         // Start instance cache
|  +         instanceCache.start();
|  +
|  +         // Start persistence
|  +         persistenceManager.start();
|  +
|  +         // Start the instance pool
|  +         instancePool.start();
|  +
|  +         // Start all interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.start();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|         {
|  -         in.start();
|  -         in = in.getNext();
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|  -
|  +
|      public void stop()
|      {
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default stop
|  -      super.stop();
|  -
|  -      // Stop container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.stop();
|  -
|  -      // Stop instance cache
|  -      instanceCache.stop();
|  -
|  -      // Stop persistence
|  -      persistenceManager.stop();
|  -
|  -      // Stop the instance pool
|  -      instancePool.stop();
|  -
|  -      // Stop all interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|         {
|  -         in.stop();
|  -         in = in.getNext();
|  +         // Call default stop
|  +         super.stop();
|  +
|  +         // Stop container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.stop();
|  +
|  +         // Stop instance cache
|  +         instanceCache.stop();
|  +
|  +         // Stop persistence
|  +         persistenceManager.stop();
|  +
|  +         // Stop the instance pool
|  +         instancePool.stop();
|  +
|  +         // Stop all interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.stop();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|  +      {
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|
|      public void destroy()
|  @@ -413,35 +429,40 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default destroy
|  -      super.destroy();
|  -
|  -      // Destroy container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.destroy();
|  -
|  -      // Destroy instance cache
|  -      instanceCache.destroy();
|  -
|  -      // Destroy persistence
|  -      persistenceManager.destroy();
|  -
|  -      // Destroy the pool
|  -      instancePool.destroy();
|  -
|  -      // Destroy all the interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|  +      {
|  +         // Call default destroy
|  +         super.destroy();
|  +
|  +         // Destroy container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.destroy();
|  +
|  +         // Destroy instance cache
|  +         instanceCache.destroy();
|  +
|  +         // Destroy persistence
|  +         persistenceManager.destroy();
|  +
|  +         // Destroy the pool
|  +         instancePool.destroy();
|  +
|  +         // Destroy all the interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.destroy();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|         {
|  -         in.destroy();
|  -         in = in.getNext();
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|  -
|  +
|      public Object invokeHome(Invocation mi) throws Exception
|      {
|
|
|
|
|  1.18      +73 -52
|jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java
|
|  Index: MessageDrivenContainer.java
|  ===================================================================
|  RCS file:
|/cvsroot/jboss/jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java,v
|  retrieving revision 1.17
|  retrieving revision 1.18
|  diff -u -r1.17 -r1.18
|  --- MessageDrivenContainer.java      19 Dec 2001 05:25:25 -0000      1.17
|  +++ MessageDrivenContainer.java      15 Feb 2002 00:17:28 -0000      1.18
|  @@ -34,7 +34,7 @@
|    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel OConnor</a>
|    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
|    * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
|  - * @version $Revision: 1.17 $
|  + * @version $Revision: 1.18 $
|    */
|   public class MessageDrivenContainer
|       extends Container
|  @@ -149,11 +149,12 @@
|
|       public void create() throws Exception
|       {
|  -        try {
|  -            // Associate thread with classloader
|  -            ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|  -
|Thread.currentThread().setContextClassLoader(getClassLoader());
|  +         // Associate thread with classloader
|  +         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|  +         Thread.currentThread().setContextClassLoader(getClassLoader());
|
|  +        try
|  +        {
|               // Call default init
|               super.create();
|
|  @@ -168,19 +169,24 @@
|
|               // Initialize the interceptor by calling the chain
|               Interceptor in = interceptor;
|  -            while (in != null) {
|  +            while (in != null)
|  +            {
|                   in.setContainer(this);
|                   in.create();
|                   in = in.getNext();
|               }
|
|  -            // Reset classloader
|  -            Thread.currentThread().setContextClassLoader(oldCl);
|           }
|  -        catch (Exception e) {
|  +        catch (Exception e)
|  +        {
|               log.error("Serious error in init: ", e);
|               throw e;
|           }
|  +        finally
|  +        {
|  +            // Reset classloader
|  +            Thread.currentThread().setContextClassLoader(oldCl);
|  +        }
|       }
|
|       public void start()
|  @@ -190,24 +196,29 @@
|           ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|           Thread.currentThread().setContextClassLoader(getClassLoader());
|
|  -        // Call default start
|  -        super.start();
|  -
|  -        // Start container invoker
|  -        containerInvoker.start();
|  -        // Start the instance pool
|  -        instancePool.start();
|  +        try
|  +        {
|  +           // Call default start
|  +           super.start();
|
|  -        // Start all interceptors in the chain
|  -        Interceptor in = interceptor;
|  -        while (in != null)
|  +           // Start container invoker
|  +           containerInvoker.start();
|  +           // Start the instance pool
|  +           instancePool.start();
|  +
|  +           // Start all interceptors in the chain
|  +           Interceptor in = interceptor;
|  +           while (in != null)
|  +           {
|  +              in.start();
|  +              in = in.getNext();
|  +           }
|  +        }
|  +        finally
|           {
|  -           in.start();
|  -           in = in.getNext();
|  +           // Reset classloader
|  +           Thread.currentThread().setContextClassLoader(oldCl);
|           }
|  -
|  -        // Reset classloader
|  -        Thread.currentThread().setContextClassLoader(oldCl);
|       }
|
|       public void stop()
|  @@ -216,25 +227,30 @@
|           ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|           Thread.currentThread().setContextClassLoader(getClassLoader());
|
|  -        // Call default stop
|  -        super.stop();
|  +        try
|  +        {
|  +           // Call default stop
|  +           super.stop();
|
|  -        // Stop container invoker
|  -        containerInvoker.stop();
|  +           // Stop container invoker
|  +           containerInvoker.stop();
|
|  -        // Stop the instance pool
|  -        instancePool.stop();
|  +           // Stop the instance pool
|  +           instancePool.stop();
|
|  -        // Stop all interceptors in the chain
|  -        Interceptor in = interceptor;
|  -        while (in != null)
|  +           // Stop all interceptors in the chain
|  +           Interceptor in = interceptor;
|  +           while (in != null)
|  +           {
|  +              in.stop();
|  +              in = in.getNext();
|  +           }
|  +        }
|  +        finally
|           {
|  -           in.stop();
|  -           in = in.getNext();
|  +           // Reset classloader
|  +           Thread.currentThread().setContextClassLoader(oldCl);
|           }
|  -
|  -        // Reset classloader
|  -        Thread.currentThread().setContextClassLoader(oldCl);
|       }
|
|       public void destroy()
|  @@ -243,25 +259,30 @@
|           ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|           Thread.currentThread().setContextClassLoader(getClassLoader());
|
|  -        // Call default destroy
|  -        super.destroy();
|  +        try
|  +        {
|  +           // Call default destroy
|  +           super.destroy();
|
|  -        // Destroy container invoker
|  -        containerInvoker.destroy();
|  +           // Destroy container invoker
|  +           containerInvoker.destroy();
|
|  -        // Destroy the pool
|  -        instancePool.destroy();
|  +           // Destroy the pool
|  +           instancePool.destroy();
|
|  -        // Destroy all the interceptors in the chain
|  -        Interceptor in = interceptor;
|  -        while (in != null)
|  +           // Destroy all the interceptors in the chain
|  +           Interceptor in = interceptor;
|  +           while (in != null)
|  +           {
|  +              in.destroy();
|  +              in = in.getNext();
|  +           }
|  +        }
|  +        finally
|           {
|  -           in.destroy();
|  -           in = in.getNext();
|  +           // Reset classloader
|  +           Thread.currentThread().setContextClassLoader(oldCl);
|           }
|  -
|  -        // Reset classloader
|  -        Thread.currentThread().setContextClassLoader(oldCl);
|       }
|
|
|
|
|
|  1.43      +147 -126
|jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java
|
|  Index: StatefulSessionContainer.java
|  ===================================================================
|  RCS file:
|/cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java,v
|  retrieving revision 1.42
|  retrieving revision 1.43
|  diff -u -r1.42 -r1.43
|  --- StatefulSessionContainer.java    12 Feb 2002 08:15:35 -0000      1.42
|  +++ StatefulSessionContainer.java    15 Feb 2002 00:17:28 -0000      1.43
|  @@ -31,7 +31,8 @@
|   * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard Öberg</a>
|   * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel OConnor</a>
|   * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
|  -* @version $Revision: 1.42 $
|  +* @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
|  +* @version $Revision: 1.43 $
|   *
|   * <p><b>Revisions</b>
|   * <p><b>20010704</b>
|  @@ -45,8 +46,8 @@
|   * </ul>
|   */
|   public class StatefulSessionContainer
|  -extends Container
|  -implements ContainerInvokerContainer, InstancePoolContainer
|  +   extends Container
|  +   implements ContainerInvokerContainer, InstancePoolContainer
|   {
|      // Constants -----------------------------------------------------
|
|  @@ -183,83 +184,93 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Acquire classes from CL
|  -      if (metaData.getHome() != null)
|  -         homeInterface = classLoader.loadClass(metaData.getHome());
|  -      if (metaData.getRemote() != null)
|  -         remoteInterface = classLoader.loadClass(metaData.getRemote());
|  -
|  -      // Call default init
|  -      super.create();
|  -
|  -      // Map the bean methods
|  -      setupBeanMapping();
|  -
|  -      // Map the home methods
|  -      setupHomeMapping();
|  -
|  -      // Map the interfaces to Long
|  -      setupMarshalledInvocationMapping();
|  -
|  -      // Init container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.create();
|  -
|  -      // Init instance cache
|  -      instanceCache.create();
|  -
|  -      // Initialize pool
|  -      instancePool.create();
|  -
|  -      // Init persistence
|  -      persistenceManager.create();
|  -
|  -      // Initialize the interceptor by calling the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|         {
|  -         in.setContainer(this);
|  -         in.create();
|  -         in = in.getNext();
|  +         // Acquire classes from CL
|  +         if (metaData.getHome() != null)
|  +            homeInterface = classLoader.loadClass(metaData.getHome());
|  +         if (metaData.getRemote() != null)
|  +            remoteInterface =
|classLoader.loadClass(metaData.getRemote());
|  +
|  +         // Call default init
|  +         super.create();
|  +
|  +         // Map the bean methods
|  +         setupBeanMapping();
|  +
|  +         // Map the home methods
|  +         setupHomeMapping();
|  +
|  +         // Map the interfaces to Long
|  +         setupMarshalledInvocationMapping();
|  +
|  +         // Init container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.create();
|  +
|  +         // Init instance cache
|  +         instanceCache.create();
|  +
|  +         // Initialize pool
|  +         instancePool.create();
|  +
|  +         // Init persistence
|  +         persistenceManager.create();
|  +
|  +         // Initialize the interceptor by calling the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.setContainer(this);
|  +            in.create();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|  +      {
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|  -
|  +
|      public void start() throws Exception
|      {
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default start
|  -      super.start();
|  -
|  -      // Start container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.start();
|  -
|  -      // Start instance cache
|  -      instanceCache.start();
|  -
|  -      // Start pool
|  -      instancePool.start();
|  -
|  -      // Start persistence
|  -      persistenceManager.start();
|  -
|  -      // Start all interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|         {
|  -         in.start();
|  -         in = in.getNext();
|  +         // Call default start
|  +         super.start();
|  +
|  +         // Start container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.start();
|  +
|  +         // Start instance cache
|  +         instanceCache.start();
|  +
|  +         // Start pool
|  +         instancePool.start();
|  +
|  +         // Start persistence
|  +         persistenceManager.start();
|  +
|  +         // Start all interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.start();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|  +      {
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|
|      public void stop()
|  @@ -267,74 +278,84 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default stop
|  -      super.stop();
|  -
|  -      // Stop container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.stop();
|  -
|  -      // Stop instance cache
|  -      instanceCache.stop();
|  -
|  -      // Stop pool
|  -      instancePool.stop();
|  -
|  -      // Stop persistence
|  -      persistenceManager.stop();
|  -
|  -      // Stop the instance pool
|  -      instancePool.stop();
|  -
|  -      // Stop all interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|  +      {
|  +         // Call default stop
|  +         super.stop();
|  +
|  +         // Stop container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.stop();
|  +
|  +         // Stop instance cache
|  +         instanceCache.stop();
|  +
|  +         // Stop pool
|  +         instancePool.stop();
|  +
|  +         // Stop persistence
|  +         persistenceManager.stop();
|  +
|  +         // Stop the instance pool
|  +         instancePool.stop();
|  +
|  +         // Stop all interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.stop();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|         {
|  -         in.stop();
|  -         in = in.getNext();
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|  -
|  +
|      public void destroy()
|      {
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default destroy
|  -      super.destroy();
|  -
|  -      // Destroy container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.destroy();
|  -
|  -      // Destroy instance cache
|  -      instanceCache.destroy();
|  -
|  -      // Destroy pool
|  -      instancePool.destroy();
|  -
|  -      // Destroy persistence
|  -      persistenceManager.destroy();
|  -
|  -      // Destroy all the interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|  +      {
|  +         // Call default destroy
|  +         super.destroy();
|  +
|  +         // Destroy container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.destroy();
|  +
|  +         // Destroy instance cache
|  +         instanceCache.destroy();
|  +
|  +         // Destroy pool
|  +         instancePool.destroy();
|  +
|  +         // Destroy persistence
|  +         persistenceManager.destroy();
|  +
|  +         // Destroy all the interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.destroy();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|         {
|  -         in.destroy();
|  -         in = in.getNext();
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|
|      public Object invokeHome(Invocation mi)
|  -   throws Exception
|  +      throws Exception
|      {
|
|         return getInterceptor().invokeHome(mi);
|  @@ -345,7 +366,7 @@
|      * the method on the particular instance through the chain of
|interceptors.
|      */
|      public Object invoke(Invocation mi)
|  -   throws Exception
|  +      throws Exception
|      {
|
|         // Invoke through interceptors
|
|
|
|  1.33      +128 -110
|jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java
|
|  Index: StatelessSessionContainer.java
|  ===================================================================
|  RCS file:
|/cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatelessSessionContain
|er.java,v
|  retrieving revision 1.32
|  retrieving revision 1.33
|  diff -u -r1.32 -r1.33
|  --- StatelessSessionContainer.java   5 Jan 2002 12:08:50 -0000       1.32
|  +++ StatelessSessionContainer.java   15 Feb 2002 00:17:28 -0000      1.33
|  @@ -32,7 +32,7 @@
|   * @author <a href="mailto:[EMAIL PROTECTED]";>Rickard Öberg</a>
|   * @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
|   * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel OConnor</a>
|  -* @version $Revision: 1.32 $
|  +* @version $Revision: 1.33 $
|   * <p><b>2001219 marc fleury</b>
|   * <ul>
|   * <li> move to the new invocation layer and Invocation object
|  @@ -147,43 +147,47 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Acquire classes from CL
|  -      if (metaData.getHome() != null)
|  -         homeInterface = classLoader.loadClass(metaData.getHome());
|  -      if (metaData.getRemote() != null)
|  -         remoteInterface = classLoader.loadClass(metaData.getRemote());
|  -
|  -      // Call default init
|  -      super.create();
|  -
|  -      // Map the bean methods
|  -      setupBeanMapping();
|  -
|  -      // Map the home methods
|  -      setupHomeMapping();
|  -
|  -      // Map the interfaces to Long
|  -      setupMarshalledInvocationMapping();
|  -
|  -      // Initialize pool
|  -      instancePool.create();
|  -
|  -      // Init container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.create();
|  -
|  -      // Initialize the interceptor by calling the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|  +      {
|  +         // Acquire classes from CL
|  +         if (metaData.getHome() != null)
|  +            homeInterface = classLoader.loadClass(metaData.getHome());
|  +         if (metaData.getRemote() != null)
|  +            remoteInterface =
|classLoader.loadClass(metaData.getRemote());
|  +         // Call default init
|  +         super.create();
|  +
|  +         // Map the bean methods
|  +         setupBeanMapping();
|  +
|  +         // Map the home methods
|  +         setupHomeMapping();
|  +
|  +         // Map the interfaces to Long
|  +         setupMarshalledInvocationMapping();
|  +
|  +         // Initialize pool
|  +         instancePool.create();
|  +
|  +         // Init container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.create();
|  +
|  +         // Initialize the interceptor by calling the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.setContainer(this);
|  +            in.create();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|         {
|  -         in.setContainer(this);
|  -         in.create();
|  -         in = in.getNext();
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|
|      public void start() throws Exception
|  @@ -191,27 +195,32 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default start
|  -      super.start();
|  -
|  -      // Start container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.start();
|  -
|  -      // Start the instance pool
|  -      instancePool.start();
|  -
|  -      // Start all interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|         {
|  -         in.start();
|  -         in = in.getNext();
|  +         // Call default start
|  +         super.start();
|  +
|  +         // Start container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.start();
|  +
|  +         // Start the instance pool
|  +         instancePool.start();
|  +
|  +         // Start all interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.start();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|  +      {
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|
|      public void stop()
|  @@ -219,27 +228,32 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default stop
|  -      super.stop();
|  -
|  -      // Stop container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.stop();
|  -
|  -      // Stop the instance pool
|  -      instancePool.stop();
|  -
|  -      // Stop all interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|         {
|  -         in.stop();
|  -         in = in.getNext();
|  +         // Call default stop
|  +         super.stop();
|  +
|  +         // Stop container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.stop();
|  +
|  +         // Stop the instance pool
|  +         instancePool.stop();
|  +
|  +         // Stop all interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.stop();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|  +      {
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|
|      public void destroy()
|  @@ -247,27 +261,32 @@
|         // Associate thread with classloader
|         ClassLoader oldCl =
|Thread.currentThread().getContextClassLoader();
|         Thread.currentThread().setContextClassLoader(getClassLoader());
|  -
|  -      // Call default destroy
|  -      super.destroy();
|  -
|  -      // Destroy container invoker
|  -      if (containerInvoker != null)
|  -         containerInvoker.destroy();
|  -
|  -      // Destroy the pool
|  -      instancePool.destroy();
|  -
|  -      // Destroy all the interceptors in the chain
|  -      Interceptor in = interceptor;
|  -      while (in != null)
|  +
|  +      try
|         {
|  -         in.destroy();
|  -         in = in.getNext();
|  +         // Call default destroy
|  +         super.destroy();
|  +
|  +         // Destroy container invoker
|  +         if (containerInvoker != null)
|  +            containerInvoker.destroy();
|  +
|  +         // Destroy the pool
|  +         instancePool.destroy();
|  +
|  +         // Destroy all the interceptors in the chain
|  +         Interceptor in = interceptor;
|  +         while (in != null)
|  +         {
|  +            in.destroy();
|  +            in = in.getNext();
|  +         }
|  +      }
|  +      finally
|  +      {
|  +         // Reset classloader
|  +         Thread.currentThread().setContextClassLoader(oldCl);
|         }
|  -
|  -      // Reset classloader
|  -      Thread.currentThread().setContextClassLoader(oldCl);
|      }
|
|      public Object invokeHome(Invocation mi) throws Exception
|  @@ -282,7 +301,7 @@
|      * on the particular instance
|      */
|      public Object invoke(Invocation mi)
|  -   throws Exception
|  +      throws Exception
|      {
|
|         // Invoke through interceptors
|  @@ -295,7 +314,7 @@
|      * No-op.
|      */
|      public void remove(Invocation mi)
|  -   throws RemoteException, RemoveException
|  +      throws RemoteException, RemoveException
|      {
|         //TODO
|      }
|  @@ -304,7 +323,7 @@
|      * @return    Always null
|      */
|      public Handle getHandle(Invocation mi)
|  -   throws RemoteException
|  +      throws RemoteException
|      {
|         // TODO
|         return null;
|  @@ -314,14 +333,14 @@
|      * @return    Always null
|      */
|      public Object getPrimaryKey(Invocation mi)
|  -   throws RemoteException
|  +      throws RemoteException
|      {
|         // TODO
|         return null;
|      }
|
|      public EJBHome getEJBHome(Invocation mi)
|  -   throws RemoteException
|  +      throws RemoteException
|      {
|         if (containerInvoker == null)
|            throw new IllegalStateException();
|  @@ -333,7 +352,7 @@
|      * @return    Always false
|      */
|      public boolean isIdentical(Invocation mi)
|  -   throws RemoteException
|  +      throws RemoteException
|      {
|         return false; // TODO
|      }
|  @@ -348,7 +367,7 @@
|      // EJBLocalHome implementation
|
|      public EJBLocalObject createLocalHome()
|  -   throws CreateException
|  +      throws CreateException
|      {
|         if (localContainerInvoker == null)
|            throw new IllegalStateException();
|  @@ -366,7 +385,7 @@
|      // EJBHome implementation ----------------------------------------
|
|      public EJBObject createHome()
|  -   throws RemoteException, CreateException
|  +      throws RemoteException, CreateException
|      {
|         if (containerInvoker == null)
|            throw new IllegalStateException();
|  @@ -379,7 +398,7 @@
|      * No-op.
|      */
|      public void removeHome(Handle handle)
|  -   throws RemoteException, RemoveException
|  +      throws RemoteException, RemoveException
|      {
|         // TODO
|      }
|  @@ -388,7 +407,7 @@
|      * No-op.
|      */
|      public void removeHome(Object primaryKey)
|  -   throws RemoteException, RemoveException
|  +      throws RemoteException, RemoveException
|      {
|         // TODO
|      }
|  @@ -397,7 +416,7 @@
|      * @return    Always null.
|      */
|      public EJBMetaData getEJBMetaDataHome()
|  -   throws RemoteException
|  +      throws RemoteException
|      {
|         // TODO
|         return null;
|  @@ -407,7 +426,7 @@
|      * @return    Always null.
|      */
|      public HomeHandle getHomeHandleHome()
|  -   throws RemoteException
|  +      throws RemoteException
|      {
|         // TODO
|         return null;
|  @@ -416,7 +435,7 @@
|      // Protected  ----------------------------------------------------
|
|      protected void setupHomeMapping()
|  -   throws NoSuchMethodException
|  +      throws NoSuchMethodException
|      {
|         boolean debug = log.isDebugEnabled();
|
|  @@ -449,7 +468,7 @@
|      }
|
|      private void setUpBeanMappingImpl( Map map, Method[] m,
|String declaringClass )
|  -   throws NoSuchMethodException
|  +      throws NoSuchMethodException
|      {
|         boolean debug = log.isDebugEnabled();
|
|  @@ -479,7 +498,7 @@
|      }
|
|      protected void setupBeanMapping()
|  -   throws NoSuchMethodException
|  +      throws NoSuchMethodException
|      {
|         Map map = new HashMap();
|
|  @@ -541,7 +560,7 @@
|      * This is the last step before invocation - all interceptors are done
|      */
|      class ContainerInterceptor
|  -   implements Interceptor
|  +      implements Interceptor
|      {
|         public void setContainer(Container con) {}
|
|  @@ -649,4 +668,3 @@
|         }
|      }
|   }
|  -
|
|
|
|
|_______________________________________________
|Jboss-development mailing list
|[EMAIL PROTECTED]
|https://lists.sourceforge.net/lists/listinfo/jboss-development


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to