[jboss-svn-commits] JBL Code SVN: r29962 - labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 4 12:49:20 EST 2009


Author: mark.little at jboss.com
Date: 2009-11-04 12:49:20 -0500 (Wed, 04 Nov 2009)
New Revision: 29962

Modified:
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java
Log:
https://jira.jboss.org/jira/browse/JBTM-522

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java	2009-11-04 17:26:43 UTC (rev 29961)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java	2009-11-04 17:49:20 UTC (rev 29962)
@@ -36,6 +36,7 @@
 import com.arjuna.ats.internal.jts.recovery.recoverycoordinators.*;
 
 import com.arjuna.ats.jts.logging.*;
+import com.arjuna.ats.internal.jts.Implementations;
 import com.arjuna.ats.internal.jts.ORBManager;
 
 import com.arjuna.common.util.logging.*;
@@ -92,43 +93,49 @@
 
     static POA getRCPOA (String domainName)
     {
-	String rcServiceName = GenericRecoveryCreator.getRecCoordServiceName();
+        String rcServiceName = GenericRecoveryCreator.getRecCoordServiceName();
 
-	if (jtsLogger.logger.isDebugEnabled())
-	{
-	    jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
-				   FacilityCode.FAC_CRASH_RECOVERY,
-				   "JacOrbRCServiceInit.getRCPOA " + rcServiceName );
-	}
+        System.err.println("**getRCPOA "+domainName);
+        
+        Thread.dumpStack();
+        
+        if (jtsLogger.logger.isDebugEnabled())
+        {
+            jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+                                   FacilityCode.FAC_CRASH_RECOVERY,
+                                   "JacOrbRCServiceInit.getRCPOA " + rcServiceName );
+        }
 
-	if (_poa == null)
-	{
-	    String poaName = POA_NAME_PREFIX + rcServiceName+domainName;
-	    boolean oaInit = true;
-	    String oaPort = "OAPort";
+        if (_poa == null)
+        {
+            String poaName = POA_NAME_PREFIX + rcServiceName+domainName;
+            boolean oaInit = true;
+            String oaPort = "OAPort";
         String oaAddr = "OAIAddr";
         String oldPort = System.getProperty(oaPort, "");
         String oldAddr = System.getProperty(oaAddr, "");
 
+        System.err.println("**POA name "+poaName);
+        
         /** If the ORB Manager hasn't been initialised then create our own ORB **/
 
-	    if ( !RecoveryORBManager.isInitialised() )
-	    {
-		_orb = com.arjuna.orbportability.internal.InternalORB.getInstance("RecoveryServer");
-		String[] params = null;
-		String recoveryManagerPort = ""+jtsPropertyManager.getJTSEnvironmentBean().getRecoveryManagerPort();
+            if ( !RecoveryORBManager.isInitialised() )
+            {
+                _orb = com.arjuna.orbportability.internal.InternalORB.getInstance("RecoveryServer");
+                String[] params = null;
+                String recoveryManagerPort = ""+jtsPropertyManager.getJTSEnvironmentBean().getRecoveryManagerPort();
         String recoveryManagerAddr = jtsPropertyManager.getJTSEnvironmentBean().getRecoveryManagerAddress();
 
         if (recoveryManagerAddr == null)
             recoveryManagerAddr = "";
 
         if (jtsLogger.loggerI18N.isInfoEnabled())
-		{
-		    jtsLogger.loggerI18N.info("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_6",
+                {
+                    jtsLogger.loggerI18N.info("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_6",
                     new java.lang.Object[]{recoveryManagerPort, recoveryManagerAddr});
-		}
+                }
 
-		final Properties p = new Properties();
+                final Properties p = new Properties();
         // Try to preload jacorb.properties
         final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader() ;
         if (contextClassLoader != null)
@@ -146,7 +153,7 @@
                 }
             }
         }
-		p.setProperty(oaPort, recoveryManagerPort);
+                p.setProperty(oaPort, recoveryManagerPort);
 
         if (recoveryManagerAddr.length() != 0)
         {
@@ -155,79 +162,79 @@
         }
 
         _orb.initORB(params, p);
-		_oa = OA.getRootOA(_orb);
+                _oa = OA.getRootOA(_orb);
 
-		if (oldPort == null)
-		    oldPort = "";
+                if (oldPort == null)
+                    oldPort = "";
 
-        System.setProperty(oaPort, oldPort);	// Remove property that JacORB added so future ORB's work.
+        System.setProperty(oaPort, oldPort);    // Remove property that JacORB added so future ORB's work.
 
         RecoveryORBManager.setORB(_orb);
-		RecoveryORBManager.setPOA(_oa);
-	    }
-	    else
-	    {
-		/** Otherwise use the ORB already registered with the ORB Manager **/
-		_orb = RecoveryORBManager.getORB();
-		_oa = (RootOA) RecoveryORBManager.getPOA();
+                RecoveryORBManager.setPOA(_oa);
+            }
+            else
+            {
+                /** Otherwise use the ORB already registered with the ORB Manager **/
+                _orb = RecoveryORBManager.getORB();
+                _oa = (RootOA) RecoveryORBManager.getPOA();
 
-		oaInit = false;
+                oaInit = false;
 
-		if (jtsLogger.loggerI18N.isInfoEnabled())
-		{
-		    jtsLogger.loggerI18N.info("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_6a", new java.lang.Object[]{oldPort});
-		}
-	    }
+                if (jtsLogger.loggerI18N.isInfoEnabled())
+                {
+                    jtsLogger.loggerI18N.info("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_6a", new java.lang.Object[]{oldPort});
+                }
+            }
 
-	    try
-	    {
-		/*
-		 * Only initialise the object adapter if we created it.
-		 * Otherwise we assume the ORB and the POA have been
-		 * initialised already.
-		 */
+            try
+            {
+                /*
+                 * Only initialise the object adapter if we created it.
+                 * Otherwise we assume the ORB and the POA have been
+                 * initialised already.
+                 */
 
-		if (oaInit)
-		    _oa.initOA();
+                if (oaInit)
+                    _oa.initOA();
 
-		if (domainName.equals("recovery_coordinator") && !ORBManager.isInitialised())
-		{
-		    try
-		    {
-			ORBManager.setORB(_orb);
-			ORBManager.setPOA(_oa);
-		    }
-		    catch (Exception ex)
-		    {
-			jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_7", ex);
-		    }
-		}
+                if (domainName.equals("recovery_coordinator") && !ORBManager.isInitialised())
+                {
+                    try
+                    {
+                        ORBManager.setORB(_orb);
+                        ORBManager.setPOA(_oa);
+                    }
+                    catch (Exception ex)
+                    {
+                        jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_7", ex);
+                    }
+                }
 
-		org.omg.CORBA.ORB theORB = _orb.orb();
-		org.omg.PortableServer.POA rootPOA = _oa.rootPoa ();
+                org.omg.CORBA.ORB theORB = _orb.orb();
+                org.omg.PortableServer.POA rootPOA = _oa.rootPoa ();
 
-		// create direct persistent POA
-		// make the policy lists, with standard policies
-		org.omg.CORBA.Policy[] policies = null;
+                // create direct persistent POA
+                // make the policy lists, with standard policies
+                org.omg.CORBA.Policy[] policies = null;
 
-		policies = new Policy []
-		{
-		    rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT),
-		    rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN),
-		    rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID),
-		    rootPOA.create_id_uniqueness_policy(IdUniquenessPolicyValue.MULTIPLE_ID),
-		    rootPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT)
-		};
+                policies = new Policy []
+                {
+                    rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT),
+                    rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.NON_RETAIN),
+                    rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID),
+                    rootPOA.create_id_uniqueness_policy(IdUniquenessPolicyValue.MULTIPLE_ID),
+                    rootPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT)
+                };
 
-		_poa = rootPOA.create_POA(poaName, rootPOA.the_POAManager(), policies);
-	    }
-	    catch (Exception ex)
-	    {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_1",ex);
-	    }
-	}
+                _poa = rootPOA.create_POA(poaName, rootPOA.the_POAManager(), policies);
+            }
+            catch (Exception ex)
+            {
+                jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_1",ex);
+            }
+        }
 
-	return _poa;
+        return _poa;
     }
 
     /**
@@ -236,71 +243,73 @@
 
     public  boolean startRCservice ()
     {
-	POA ourPOA = getRCPOA("recovery_coordinator");
+        POA ourPOA = getRCPOA("recovery_coordinator");
 
-	try
-	    {
-		// get the orb, so we can pass it to the default servant
+        Implementations.initialise();
+        
+        try
+            {
+                // get the orb, so we can pass it to the default servant
 
-		// make the default servant
-		JacOrbRCDefaultServant theButler = new JacOrbRCDefaultServant(_orb.orb());
+                // make the default servant
+                JacOrbRCDefaultServant theButler = new JacOrbRCDefaultServant(_orb.orb());
 
-		// register it on the POA
-		ourPOA.set_servant(theButler);
+                // register it on the POA
+                ourPOA.set_servant(theButler);
 
-		org.omg.CORBA.Object obj = ourPOA.create_reference_with_id("RecoveryManager".getBytes(),
-									   RecoveryCoordinatorHelper.id());
+                org.omg.CORBA.Object obj = ourPOA.create_reference_with_id("RecoveryManager".getBytes(),
+                                                                           RecoveryCoordinatorHelper.id());
 
-		// Write the object refenece in the file
+                // Write the object refenece in the file
 
-		String reference = _orb.orb().object_to_string(obj);
+                String reference = _orb.orb().object_to_string(obj);
 
-		try
-		    {
-			if (currentStore == null)
-			{
-			    currentStore = TxControl.getStore();
-			}
+                try
+                    {
+                        if (currentStore == null)
+                        {
+                            currentStore = TxControl.getStore();
+                        }
 
-			OutputObjectState oState = new OutputObjectState();
-			oState.packString(reference);
-			currentStore.write_committed( new Uid(uid4Recovery), type(), oState);
-		    }
-		catch ( java.lang.SecurityException sex )
-		    {
-			jtsLogger.loggerI18N.fatal("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_5");
-	  }
+                        OutputObjectState oState = new OutputObjectState();
+                        oState.packString(reference);
+                        currentStore.write_committed( new Uid(uid4Recovery), type(), oState);
+                    }
+                catch ( java.lang.SecurityException sex )
+                    {
+                        jtsLogger.loggerI18N.fatal("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_5");
+          }
 
-		if (jtsLogger.loggerI18N.isDebugEnabled())
-		    {
-			jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
-						   FacilityCode.FAC_CRASH_RECOVERY,
-						   "com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_2");
-		    }
+                if (jtsLogger.loggerI18N.isDebugEnabled())
+                    {
+                        jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+                                                   FacilityCode.FAC_CRASH_RECOVERY,
+                                                   "com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_2");
+                    }
 
-		// activate the poa
+                // activate the poa
 
-		_oa.rootPoa().the_POAManager().activate();
+                _oa.rootPoa().the_POAManager().activate();
 
-		//_oa.run();
-		ORBRunner _runOA = new ORBRunner();
+                //_oa.run();
+                ORBRunner _runOA = new ORBRunner();
 
-		return true;
-	    } catch (Exception ex) {
-		jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_3", ex);
-		return false;
-	    }
+                return true;
+            } catch (Exception ex) {
+                jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_3", ex);
+                return false;
+            }
 
     }
 
     public static void shutdownRCService ()
     {
-	_poa = null;
+        _poa = null;
     }
 
     public static String type ()
     {
-	return "/RecoveryCoordinator";
+        return "/RecoveryCoordinator";
     }
 
 
@@ -318,9 +327,7 @@
     private static final String orbName = "arjuna.portable_interceptor.";
 
     private ObjectStore     currentStore;
-    static protected String uid4Recovery = "0:52e38d0c:c91:4140398c:0";
 
+    static protected String uid4Recovery = "0:ffff52e38d0c:c91:4140398c:0";
 
-};
-
-
+};
\ No newline at end of file



More information about the jboss-svn-commits mailing list