[jboss-cvs] JBossAS SVN: r75685 - branches/Branch_4_2/test/src/main/org/jboss/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 11 08:55:53 EDT 2008


Author: dimitris at jboss.org
Date: 2008-07-11 08:55:52 -0400 (Fri, 11 Jul 2008)
New Revision: 75685

Modified:
   branches/Branch_4_2/test/src/main/org/jboss/test/JBossIIOPTestCase.java
Log:
JBAS-5758, cache the initial context to avoid premature ORB destruction

Modified: branches/Branch_4_2/test/src/main/org/jboss/test/JBossIIOPTestCase.java
===================================================================
--- branches/Branch_4_2/test/src/main/org/jboss/test/JBossIIOPTestCase.java	2008-07-11 12:52:47 UTC (rev 75684)
+++ branches/Branch_4_2/test/src/main/org/jboss/test/JBossIIOPTestCase.java	2008-07-11 12:55:52 UTC (rev 75685)
@@ -23,6 +23,7 @@
 
 import java.net.URL;
 import java.util.Properties;
+
 import javax.naming.InitialContext;
 
 /**
@@ -30,12 +31,17 @@
  * cosnaming service.
  * 
  * @author Scott.Stark at jboss.org
+ * @author Dimitris.Andreadis at jboss.org
+ * 
  * @version $Revision$
  */
 public class JBossIIOPTestCase extends JBossTestCase
 {
+   // JBAS-5758, cache the initial context to avoid premature ORB destruction
+   protected InitialContext ic = null;
+
    protected Properties jndiProps;
-
+   
    public JBossIIOPTestCase(String name)
    {
       super(name);
@@ -44,7 +50,7 @@
    // Override getInitialContext() ----------------------------------
    protected InitialContext getInitialContext() throws Exception
    {
-      if( jndiProps == null )
+      if (jndiProps == null)
       {
          URL url  = ClassLoader.getSystemResource("cosnaming.jndi.properties");
          jndiProps = new java.util.Properties();
@@ -53,12 +59,15 @@
          String corbaloc = "corbaloc::"+host+":3528/JBoss/Naming/root";
          jndiProps.setProperty("java.naming.provider.url", corbaloc);
       }
-      return new InitialContext(jndiProps);
+
+      if (ic == null)
+         ic = new InitialContext(jndiProps);
+      
+      return ic;
    }
    
    protected InitialContext getInitialJnpContext() throws Exception
    {
       return super.getInitialContext();
    }
-
 }




More information about the jboss-cvs-commits mailing list