[jboss-cvs] JBossAS SVN: r77101 - projects/test/trunk/src/main/java/org/jboss/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 15 06:06:01 EDT 2008


Author: dimitris at jboss.org
Date: 2008-08-15 06:06:01 -0400 (Fri, 15 Aug 2008)
New Revision: 77101

Modified:
   projects/test/trunk/src/main/java/org/jboss/test/JBossIIOPTestCase.java
Log:
JBTEST-5, Cache the initial context to avoid premature ORB destruction, to work around jdk6 bug

Modified: projects/test/trunk/src/main/java/org/jboss/test/JBossIIOPTestCase.java
===================================================================
--- projects/test/trunk/src/main/java/org/jboss/test/JBossIIOPTestCase.java	2008-08-15 09:33:09 UTC (rev 77100)
+++ projects/test/trunk/src/main/java/org/jboss/test/JBossIIOPTestCase.java	2008-08-15 10:06:01 UTC (rev 77101)
@@ -1,28 +1,29 @@
 /*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.test;
 
 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