[jboss-svn-commits] JBL Code SVN: r6408 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery atsintegration/classes/com/arjuna/ats/jbossatx/jta atsintegration/classes/com/arjuna/ats/jbossatx/jts

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 25 05:42:34 EDT 2006


Author: kevin.conner at jboss.com
Date: 2006-09-25 05:42:28 -0400 (Mon, 25 Sep 2006)
New Revision: 6408

Modified:
   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/RecoveryManagerImple.java
   labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
   labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java
Log:
Delay start of the Recovery Manager for JBTM-81

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	2006-09-25 09:34:18 UTC (rev 6407)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java	2006-09-25 09:42:28 UTC (rev 6408)
@@ -107,7 +107,7 @@
      * been created yet then it will be. The manager can be created in a
      * management mode defined by the parameter.
      *
-     * @param int mode the management mode for the manager.
+     * @param mode the management mode for the manager.
      *
      * @throw IllegalArgumentException thrown if the manager has already been
      * created in a different mode to that requested.
@@ -127,6 +127,14 @@
 	
 	return _recoveryManager;
     }
+    
+    /**
+     * Delay the start of the recovery manager thread when creating an indirect recovery manager.
+     */
+    public static synchronized void delayRecoveryManagerThread()
+    {
+        delayRecoveryManagerThread = true ;
+    }
 
     /**
      * Force a recovery scan now. This is a blocking operation
@@ -163,6 +171,14 @@
     {
 	_theImple.stop();
     }
+    
+    /**
+     * Start the recovery manager thread.
+     */
+    public void startRecoveryManagerThread()
+    {
+        _theImple.start() ;
+    }
 
     /**
      * Add a recovery module to the system.
@@ -233,7 +249,7 @@
 
     private RecoveryManager (int mode)
     {
-	if (mode == RecoveryManager.INDIRECT_MANAGEMENT)
+	if ((mode == RecoveryManager.INDIRECT_MANAGEMENT) && !delayRecoveryManagerThread)
 	    _theImple = new RecoveryManagerImple(true);
 	else
 	    _theImple = new RecoveryManagerImple(false);
@@ -245,5 +261,5 @@
     private int _mode;
     
     private static RecoveryManager _recoveryManager = null;
-    
+    private static boolean delayRecoveryManagerThread ;
 }

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	2006-09-25 09:34:18 UTC (rev 6407)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java	2006-09-25 09:42:28 UTC (rev 6408)
@@ -67,7 +67,7 @@
    /**
     * Does the work of setting up crash recovery. 
     *
-    * @param boolean threaded if <code>true</code> then the manager will start
+    * @param threaded if <code>true</code> then the manager will start
     * a separate thread to run recovery periodically.
     *
     * @message com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple_1 [com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple_1] -  property io exception {0}
@@ -159,6 +159,14 @@
 	return _periodicRecovery.getModules();
     }
     
+    public void start()
+    {
+        if (!_periodicRecovery.isAlive())
+        {
+            _periodicRecovery.start() ;
+        }
+    }
+    
    public void stop ()
    {
       _periodicRecovery.shutdown();

Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java	2006-09-25 09:34:18 UTC (rev 6407)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java	2006-09-25 09:42:28 UTC (rev 6408)
@@ -34,6 +34,7 @@
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.system.server.Server;
 import org.jboss.tm.JBossXATerminator;
+import org.jboss.tm.LastResource;
 import org.jboss.tm.XAExceptionFormatter;
 
 import com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator;
@@ -109,6 +110,7 @@
         LocalJBossAgentImpl.setLocalAgent(this.getServer());
         System.setProperty(com.arjuna.ats.tsmx.TransactionServiceMX.AGENT_IMPLEMENTATION_PROPERTY,
                 com.arjuna.ats.internal.jbossatx.agent.LocalJBossAgentImpl.class.getName());
+        System.setProperty(Environment.LAST_RESOURCE_OPTIMISATION_INTERFACE, LastResource.class.getName()) ;
 
         /** Register management plugin **/
         com.arjuna.ats.arjuna.common.arjPropertyManager.propertyManager.addManagementPlugin(new PropertyServiceJMXPlugin());
@@ -131,6 +133,13 @@
             if (_runRM)
             {
                 registerNotification() ;
+                
+                this.getLog().info("Starting recovery manager");
+
+                RecoveryManager.delayRecoveryManagerThread() ;
+                _recoveryManager = RecoveryManager.manager() ;
+
+                this.getLog().info("Recovery manager started");
             }
             else
             {
@@ -168,11 +177,7 @@
      */
     public void handleNotification(final Notification notification, final Object param)
     {
-        this.getLog().info("Starting recovery manager");
-
-        _recoveryManager = RecoveryManager.manager() ;
-
-        this.getLog().info("Recovery manager started");
+        _recoveryManager.startRecoveryManagerThread() ;
     }
 
     private boolean isRecoveryManagerRunning() throws Exception
@@ -339,7 +344,7 @@
 
     /**
      * Retrieves whether the statistics are enabled.
-     * @return
+     * @return true if enabled, false otherwise.
      */
     public boolean getStatisticsEnabled()
     {
@@ -368,7 +373,7 @@
 
     /**
      * Returns the number of active transactions
-     * @return
+     * @return The number of active transactions.
      */
     public long getTransactionCount()
     {
@@ -377,7 +382,7 @@
 
     /**
      * Returns the number of committed transactions
-     * @return
+     * @return The number of committed transactions.
      */
     public long getCommitCount()
     {
@@ -386,7 +391,7 @@
 
     /**
      * Returns the number of rolledback transactions
-     * @return
+     * @return The number of rolledback transactions.
      */
     public long getRollbackCount()
     {

Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java	2006-09-25 09:34:18 UTC (rev 6407)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java	2006-09-25 09:42:28 UTC (rev 6408)
@@ -35,6 +35,7 @@
 import org.jboss.iiop.CorbaORBService;
 import org.jboss.mx.util.ObjectNameFactory;
 import org.jboss.tm.JBossXATerminator;
+import org.jboss.tm.LastResource;
 import org.jboss.tm.XAExceptionFormatter;
 import com.arjuna.ats.internal.jbossatx.jts.PropagationContextWrapper;
 import com.arjuna.ats.internal.jbossatx.jts.jca.XATerminator;
@@ -115,6 +116,7 @@
         LocalJBossAgentImpl.setLocalAgent(this.getServer());
         System.setProperty(com.arjuna.ats.tsmx.TransactionServiceMX.AGENT_IMPLEMENTATION_PROPERTY,
                 com.arjuna.ats.internal.jbossatx.agent.LocalJBossAgentImpl.class.getName());
+        System.setProperty(Environment.LAST_RESOURCE_OPTIMISATION_INTERFACE, LastResource.class.getName()) ;
 
         /** Register management plugin **/
         com.arjuna.ats.arjuna.common.arjPropertyManager.propertyManager.addManagementPlugin(new PropertyServiceJMXPlugin());
@@ -152,6 +154,13 @@
             if (_runRM)
             {
                 registerNotification() ;
+                
+                this.getLog().info("Starting recovery manager");
+
+                RecoveryManager.delayRecoveryManagerThread() ;
+                _recoveryManager = RecoveryManager.manager() ;
+
+                this.getLog().info("Recovery manager started");
             }
             else
             {
@@ -189,11 +198,7 @@
      */
     public void handleNotification(final Notification notification, final Object param)
     {
-        this.getLog().info("Starting recovery manager");
-
-        _recoveryManager = RecoveryManager.manager() ;
-
-        this.getLog().info("Recovery manager started");
+        _recoveryManager.startRecoveryManagerThread() ;
     }
 
     private boolean isRecoveryManagerRunning() throws Exception
@@ -362,7 +367,7 @@
 
     /**
      * Retrieves whether the statistics are enabled.
-     * @return
+     * @return true if enabled, false otherwise.
      */
     public boolean getStatisticsEnabled()
     {
@@ -391,7 +396,7 @@
 
     /**
      * Returns the number of active transactions
-     * @return
+     * @return The number of active transactions.
      */
     public long getTransactionCount()
     {
@@ -400,7 +405,7 @@
 
     /**
      * Returns the number of committed transactions
-     * @return
+     * @return The number of committed transactions.
      */
     public long getCommitCount()
     {
@@ -409,7 +414,7 @@
 
     /**
      * Returns the number of rolledback transactions
-     * @return
+     * @return The number of rolledback transactions.
      */
     public long getRollbackCount()
     {




More information about the jboss-svn-commits mailing list