[jboss-svn-commits] JBL Code SVN: r35455 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 7 12:45:51 EDT 2010


Author: jhalliday
Date: 2010-10-07 12:45:49 -0400 (Thu, 07 Oct 2010)
New Revision: 35455

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/logging/arjunaI18NLogger.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryActivator.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecActivatorLoader.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ORBManager.java
   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/recovery/RecoveryEnablement.java
Log:
Recovery orb setup exception handling improvements. JBTM-797


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/logging/arjunaI18NLogger.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/logging/arjunaI18NLogger.java	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/logging/arjunaI18NLogger.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -1265,25 +1265,25 @@
 	@LogMessage(level = WARN)
 	public void warn_recovery_PeriodicRecovery_9(@Cause() Throwable arg0);
 
-	@Message(id = 12319, value = "Attempt to load recovery activator with null class name!", format = MESSAGE_FORMAT)
-	@LogMessage(level = WARN)
-	public void warn_recovery_RecActivatorLoader_1();
+//	@Message(id = 12319, value = "Attempt to load recovery activator with null class name!", format = MESSAGE_FORMAT)
+//	@LogMessage(level = WARN)
+//	public void warn_recovery_RecActivatorLoader_1();
 
-	@Message(id = 12320, value = "Recovery module {0} does not conform to RecoveryActivator interface", format = MESSAGE_FORMAT)
-	@LogMessage(level = WARN)
-	public void warn_recovery_RecActivatorLoader_2(String arg0);
+//	@Message(id = 12320, value = "Recovery module {0} does not conform to RecoveryActivator interface", format = MESSAGE_FORMAT)
+//	@LogMessage(level = WARN)
+//	public void warn_recovery_RecActivatorLoader_2(String arg0);
 
-	@Message(id = 12321, value = "Loading recovery activator", format = MESSAGE_FORMAT)
-	@LogMessage(level = WARN)
-	public void warn_recovery_RecActivatorLoader_3(@Cause() Throwable arg0);
+//	@Message(id = 12321, value = "Loading recovery activator", format = MESSAGE_FORMAT)
+//	@LogMessage(level = WARN)
+//	public void warn_recovery_RecActivatorLoader_3(@Cause() Throwable arg0);
 
-	@Message(id = 12322, value = "Loading recovery activator", format = MESSAGE_FORMAT)
-	@LogMessage(level = WARN)
-	public void warn_recovery_RecActivatorLoader_4(@Cause() Throwable arg0);
+//	@Message(id = 12322, value = "Loading recovery activator", format = MESSAGE_FORMAT)
+//	@LogMessage(level = WARN)
+//	public void warn_recovery_RecActivatorLoader_4(@Cause() Throwable arg0);
 
-	@Message(id = 12323, value = "Loading recovery module: could not find class {0}", format = MESSAGE_FORMAT)
-	@LogMessage(level = WARN)
-	public void warn_recovery_RecActivatorLoader_5(String arg0);
+//	@Message(id = 12323, value = "Loading recovery module: could not find class {0}", format = MESSAGE_FORMAT)
+//	@LogMessage(level = WARN)
+//	public void warn_recovery_RecActivatorLoader_5(String arg0);
 
 	@Message(id = 12324, value = "Start RecoveryActivators", format = MESSAGE_FORMAT)
 	@LogMessage(level = INFO)
@@ -1434,6 +1434,9 @@
     @Message(id = 12363, value = "Invalid rootName. Expected {0} but was {1}", format = MESSAGE_FORMAT)
     public String get_StoreManager_invalidroot(String arg0, String arg1);
 
+    @Message(id = 12364, value = "RecoveryActivator init failed for {0}", format = MESSAGE_FORMAT)
+	public String get_recovery_RecActivatorLoader_initfailed(String arg0);
+
     /*
         Allocate new messages directly above this notice.
           - id: use the next id number in numeric sequence. Don't reuse ids.

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryActivator.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryActivator.java	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryActivator.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -38,12 +38,8 @@
     /**
      * Called to create appropriate instance(s), specific to a standard transaction protocol,
      * able to receive inquiries for recovery
+     *
+     * @return true on success, false on failure
      */
     public boolean startRCservice();
-    /*
-     * For the moment let's say that this operation doesn't take any arguments.
-     * If let without arguments we should obtain the Recoverymanager Tag within the class that 
-     * load the RecoveryActivators
-     */
-
 }

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -406,22 +406,16 @@
 
             try
             {
-                if(testMode) {
-                    // vicious kludge to sidestep ORB init issue.
-                    // TODO: replace with something less cringeworthy.
-                    Thread.sleep(2000);
-                }
-
                 manager = manager();
             }
-            catch(java.lang.Error e)
+            catch(Throwable e)
             {
                 if(testMode)
                 {
                     // in some test cases the recovery manager is killed and restarted in quick succession.
                     // sometimes the O/S does not free up the port fast enough, so we can't reclaim it on restart.
                     // For test mode only, we therefore have a simple backoff-retry kludge:
-                    System.err.println("Warning: got error '"+e.toString()+"' on startup, will retry in 5 seconds in the hope it is transient.");
+                    System.err.println("Warning: got exception '"+e.toString()+"' on startup, will retry in 5 seconds in the hope it is transient.");
                     try
                     {
                         Thread.sleep(5000);

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecActivatorLoader.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecActivatorLoader.java	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecActivatorLoader.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -27,6 +27,7 @@
 import com.arjuna.ats.arjuna.common.recoveryPropertyManager;
 
 import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.internal.arjuna.common.ClassloadingUtility;
 
 /**
  * RecoveryActivators are dynamically loaded. The recoveryActivator to load
@@ -34,103 +35,43 @@
  * <P>
  * @author Malik Saheb
  * @since ArjunaTS 3.0
-*/
+ */
 
 public class RecActivatorLoader
 {
+    public RecActivatorLoader()
+    {
+        loadRecoveryActivators();
+    }
 
-   public RecActivatorLoader()
-   {
-       initialise();
-
-       // Load the Recovery Activators
-       loadRecoveryActivators();
-
-       startRecoveryActivators();
-
-   }
-
-  /**
-   * Start the RecoveryActivator
-   */
-
-  public void startRecoveryActivators()
-      //public void run()
-  {
-      tsLogger.i18NLogger.info_recovery_RecActivatorLoader_6();
-
-      Enumeration activators = _recoveryActivators.elements();
-
-      while (activators.hasMoreElements())
-	  {
-	      RecoveryActivator acti = (RecoveryActivator) activators.nextElement();
-	      acti.startRCservice();
-	  }
-
-      return;
-
-  }
-
     // These are loaded in list iteration order.
-    private static void loadRecoveryActivators ()
+    private void loadRecoveryActivators ()
     {
-        Vector<String> activatorNames = new Vector<String>(recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryActivators());
+        List<String> activatorNames = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryActivators();
 
         for(String activatorName : activatorNames) {
-            loadActivator(activatorName);
+            RecoveryActivator recoveryActivator = ClassloadingUtility.loadAndInstantiateClass(RecoveryActivator.class, activatorName, null);
+            if(recoveryActivator != null) {
+                _recoveryActivators.add(recoveryActivator);
+            }
         }
     }
 
-  private static void loadActivator (String className)
-  {
-      if (tsLogger.logger.isDebugEnabled()) {
-          tsLogger.logger.debug("Loading recovery activator " +
-                  className);
-      }
+    public void startRecoveryActivators() throws RuntimeException
+    {
+        tsLogger.i18NLogger.info_recovery_RecActivatorLoader_6();
 
-      if (className == null) {
-          tsLogger.i18NLogger.warn_recovery_RecActivatorLoader_1();
+        for(RecoveryActivator recoveryActivator : _recoveryActivators)
+        {
+            if(!recoveryActivator.startRCservice()) {
+                throw new RuntimeException( tsLogger.i18NLogger.get_recovery_RecActivatorLoader_initfailed(recoveryActivator.getClass().getCanonicalName()));
+            }
+        }
+    }
 
-          return;
-      }
-      else
-	  {
-	      try
-		  {
-		      Class c = Thread.currentThread().getContextClassLoader().loadClass( className ) ;
-
-		      try
-			  {
-			      RecoveryActivator ra = (RecoveryActivator) c.newInstance() ;
-			      _recoveryActivators.add( ra );
-			  }
-		      catch (ClassCastException e) {
-                  tsLogger.i18NLogger.warn_recovery_RecActivatorLoader_2(className);
-              }
-		      catch (IllegalAccessException iae) {
-                  tsLogger.i18NLogger.warn_recovery_RecActivatorLoader_3(iae);
-              }
-		      catch (InstantiationException ie) {
-                  tsLogger.i18NLogger.warn_recovery_RecActivatorLoader_4(ie);
-              }
-
-		      c = null;
-		  }
-	      catch ( ClassNotFoundException cnfe ) {
-              tsLogger.i18NLogger.warn_recovery_RecActivatorLoader_5(className);
-          }
-      }
-  }
-
-    private final void initialise ()
-   {
-       _recoveryActivators = new Vector();
-   }
-
     // this refers to the recovery activators specified in the recovery manager
     // property file which are dynamically loaded.
-    private static Vector _recoveryActivators = null ;
-
+    private final List<RecoveryActivator> _recoveryActivators = new ArrayList<RecoveryActivator>();
 }
 
 

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -48,74 +48,75 @@
 
 public class RecoveryManagerImple
 {
-        private PeriodicRecovery _periodicRecovery = null;
+    private PeriodicRecovery _periodicRecovery = null;
 
-        private RecActivatorLoader _recActivatorLoader = null;
+    private RecActivatorLoader _recActivatorLoader = null;
 
-        /**
-         * Does the work of setting up crash recovery.
-         *
-         * @param threaded
-         *            if <code>true</code> then the manager will start a separate
-         *            thread to run recovery periodically.
-         */
+    /**
+     * Does the work of setting up crash recovery.
+     *
+     * @param threaded
+     *            if <code>true</code> then the manager will start a separate
+     *            thread to run recovery periodically.
+     */
 
-        public RecoveryManagerImple (boolean threaded)
-        {
+    public RecoveryManagerImple (boolean threaded)
+    {
         // by default we use a socket based listener, but it can be turned off if not required.
         boolean useListener = recoveryPropertyManager.getRecoveryEnvironmentBean().isRecoveryListener();
-        
+
         /*
-                 * Check whether there is a recovery daemon running - only allow one per
-                 * object store
-                 *
-                 * Note: this does not actually check if a recovery manager is running for the same ObjectStore,
-                 * only if one is on the same port as our configuration. Thus it's not particularly robust.
-                 * TODO: add a lock file to the ObjectStore as a belt and braces approach?
-                 *
-                 * This check works by trying to bind the server socket, so don't do it if we are running local only
-                 * (yup, that means there is a greater chance of winding up with more than one recovery manager if
-                 * we are running without a listener. See comment on robustness and file locking.)
-                 */
+        * Check whether there is a recovery daemon running - only allow one per
+        * object store
+        *
+        * Note: this does not actually check if a recovery manager is running for the same ObjectStore,
+        * only if one is on the same port as our configuration. Thus it's not particularly robust.
+        * TODO: add a lock file to the ObjectStore as a belt and braces approach?
+        *
+        * This check works by trying to bind the server socket, so don't do it if we are running local only
+        * (yup, that means there is a greater chance of winding up with more than one recovery manager if
+        * we are running without a listener. See comment on robustness and file locking.)
+        */
 
-                if (useListener && isRecoveryManagerEndPointInUse())
-                {
+        if (useListener && isRecoveryManagerEndPointInUse())
+        {
 
-                try
-                {
-                    tsLogger.i18NLogger.fatal_recovery_fail(RecoveryManager.getRecoveryManagerHost().getHostAddress(),
-                            Integer.toString(RecoveryManager.getRecoveryManagerPort()));
-                }
-                catch (Throwable t)
-                {
-                    tsLogger.i18NLogger.fatal_recovery_fail("unknown", "unknown");
-                }
+            try
+            {
+                tsLogger.i18NLogger.fatal_recovery_fail(RecoveryManager.getRecoveryManagerHost().getHostAddress(),
+                        Integer.toString(RecoveryManager.getRecoveryManagerPort()));
+            }
+            catch (Throwable t)
+            {
+                tsLogger.i18NLogger.fatal_recovery_fail("unknown", "unknown");
+            }
 
 
             throw new FatalError("Recovery manager already active (or recovery port and address are in use)!");
-                }
+        }
 
-                // start the expiry scanners
+        // start the expiry scanners
 
-                // start the activator recovery loader
+        // start the activator recovery loader
 
-                _recActivatorLoader = new RecActivatorLoader();
+        _recActivatorLoader = new RecActivatorLoader();
+        _recActivatorLoader.startRecoveryActivators();
 
-                // start the expiry scanners
+        // start the expiry scanners
 
-                ExpiredEntryMonitor.startUp();
+        ExpiredEntryMonitor.startUp();
 
-                // start the periodic recovery thread
-                // (don't start this until just about to go on to the other stuff)
+        // start the periodic recovery thread
+        // (don't start this until just about to go on to the other stuff)
 
-                _periodicRecovery = new PeriodicRecovery(threaded, useListener);
+        _periodicRecovery = new PeriodicRecovery(threaded, useListener);
 
-                try
+        try
+        {
+            if (tsLogger.logger.isInfoEnabled())
+            {
+                if(useListener)
                 {
-                        if (tsLogger.logger.isInfoEnabled())
-                        {
-                                if(useListener)
-                {
                     tsLogger.i18NLogger.info_recovery_socketready( Integer.toString(_periodicRecovery.getServerSocket().getLocalPort()));
                 }
                 else
@@ -123,22 +124,22 @@
                     tsLogger.i18NLogger.info_recovery_localready();
                 }
             }
-                }
-                catch (IOException ex) {
-                    tsLogger.i18NLogger.warn_recovery_RecoveryManagerImple_2(ex);
-                }
         }
-
-        public final void scan ()
-        {
-                _periodicRecovery.doWork();
+        catch (IOException ex) {
+            tsLogger.i18NLogger.warn_recovery_RecoveryManagerImple_2(ex);
         }
+    }
 
-        public final void addModule (RecoveryModule module)
-        {
-                _periodicRecovery.addModule(module);
-        }
+    public final void scan ()
+    {
+        _periodicRecovery.doWork();
+    }
 
+    public final void addModule (RecoveryModule module)
+    {
+        _periodicRecovery.addModule(module);
+    }
+
     public final void removeModule (RecoveryModule module, boolean waitOnScan)
     {
         _periodicRecovery.removeModule(module, waitOnScan);
@@ -148,64 +149,64 @@
     {
         _periodicRecovery.removeAllModules(waitOnScan);
     }
-    
-        public final Vector getModules ()
-        {
-                return _periodicRecovery.getModules();
-        }
 
-        public void start ()
+    public final Vector getModules ()
+    {
+        return _periodicRecovery.getModules();
+    }
+
+    public void start ()
+    {
+        if (!_periodicRecovery.isAlive())
         {
-                if (!_periodicRecovery.isAlive())
-                {
-                        _periodicRecovery.start();
-                }
+            _periodicRecovery.start();
         }
+    }
 
     /**
      * stop the recovery manager
      * @param async false means wait for any recovery scan in progress to complete
      */
-        public void stop (boolean async)
-        {
-            // must ensure we clean up dependent threads
+    public void stop (boolean async)
+    {
+        // must ensure we clean up dependent threads
 
-                ExpiredEntryMonitor.shutdown();
+        ExpiredEntryMonitor.shutdown();
 
-                _periodicRecovery.shutdown(async);
-        }
+        _periodicRecovery.shutdown(async);
+    }
 
-        /**
-         * Suspend the recovery manager. If the recovery manager is in the process of
-         * doing recovery scans then it will be suspended afterwards, in order to
-         * preserve data integrity.
-         *
-         * @param async false means wait for the recovery manager to finish any scans before returning.
-         */
+    /**
+     * Suspend the recovery manager. If the recovery manager is in the process of
+     * doing recovery scans then it will be suspended afterwards, in order to
+     * preserve data integrity.
+     *
+     * @param async false means wait for the recovery manager to finish any scans before returning.
+     */
 
-        public void suspendScan (boolean async)
-        {
-            _periodicRecovery.suspendScan(async);
-        }
+    public void suspendScan (boolean async)
+    {
+        _periodicRecovery.suspendScan(async);
+    }
 
-        public void resumeScan ()
+    public void resumeScan ()
+    {
+        _periodicRecovery.resumeScan();
+    }
+
+    /**
+     * wait for the recovery implementation to be shut down.
+     */
+    public void waitForTermination ()
+    {
+        try
         {
-            _periodicRecovery.resumeScan();
+            _periodicRecovery.join();
         }
-
-       /**
-        * wait for the recovery implementation to be shut down.
-        */
-        public void waitForTermination ()
+        catch (final Exception ex)
         {
-            try
-            {
-                _periodicRecovery.join();
-            }
-            catch (final Exception ex)
-            {
-            }
         }
+    }
 
     /**
      * Test whether the recovery manager (RM) port and address are available - if not assume that another

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ORBManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ORBManager.java	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/ORBManager.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -118,6 +118,11 @@
         return (_theOrb != null || _thePoa != null);
     }
 
+    public static void reset() {
+        _theOrb = null;
+        _thePoa = null;
+    }
+
     private static com.arjuna.orbportability.ORB _theOrb = null;
 
     private static com.arjuna.orbportability.OA _thePoa = null;

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	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -144,9 +144,15 @@
                 p.setProperty("OAIAddr", recoveryManagerAddr);
             }
 
-            _orb.initORB((String[])null, p);
-            _oa = OA.getRootOA(_orb);
-            _oa.initOA();
+            try {
+                _orb.initORB((String[])null, p);
+                _oa = OA.getRootOA(_orb);
+                _oa.initOA();
+            } catch(RuntimeException e) {
+                ORBManager.reset();
+                _orb.shutdown();
+                throw e;
+            }
 
             ORBManager.setORB(_orb);
             ORBManager.setPOA(_oa);

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/recovery/RecoveryEnablement.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/recovery/RecoveryEnablement.java	2010-10-07 12:02:58 UTC (rev 35454)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/recovery/RecoveryEnablement.java	2010-10-07 16:45:49 UTC (rev 35455)
@@ -103,38 +103,36 @@
 
     public boolean startRCservice()
     {
-	int orbType = ORBInfo.getOrbEnumValue();
-	boolean result = false;
-	RecoveryServiceInit recoveryService = null;
+        int orbType = ORBInfo.getOrbEnumValue();
+        RecoveryServiceInit recoveryService = null;
+        boolean outcome = false;
+        String theClassName = null;
 
-	String theClassName = null;
-
-	// The class that should start the service shall not be called directly. An intermediate class shall be used
-	try
-	{
-	    switch (orbType)
-	    {
-	    case ORBType.JACORB:
-		{
-		    theClassName = "com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit";
-		    recoveryService = (RecoveryServiceInit) Thread.currentThread().getContextClassLoader().loadClass(theClassName).newInstance();
-		    recoveryService.startRCservice();
-
-		    result = true;
-		}
-		break;
-	    default: {
-            jtsLogger.i18NLogger.warn_recovery_RecoveryEnablement_1();
+        // The class that should start the service shall not be called directly. An intermediate class shall be used
+        try
+        {
+            switch (orbType)
+            {
+                case ORBType.JACORB:
+                {
+                    theClassName = "com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit";
+                    recoveryService = (RecoveryServiceInit) Thread.currentThread().getContextClassLoader().loadClass(theClassName).newInstance();
+                    outcome = recoveryService.startRCservice();
+                }
+                break;
+                default: {
+                    jtsLogger.i18NLogger.warn_recovery_RecoveryEnablement_1();
+                    outcome = false;
+                }
+                break;
+            }
         }
-		break;
-	    }
-	}
-	catch (Exception e)
-	{
-        jtsLogger.i18NLogger.warn_recovery_RecoveryEnablement_6(e);
-	}
+        catch (Exception e)
+        {
+            jtsLogger.i18NLogger.warn_recovery_RecoveryEnablement_6(e);
+        }
 
-	return result;
+        return outcome;
     }
 
     /**



More information about the jboss-svn-commits mailing list