[jboss-svn-commits] JBL Code SVN: r27527 - in labs/jbosstm/trunk/ArjunaCore/arjuna: classes/com/arjuna/ats/internal/arjuna/recovery and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Jul 4 04:14:18 EDT 2009
Author: mark.little at jboss.com
Date: 2009-07-04 04:14:17 -0400 (Sat, 04 Jul 2009)
New Revision: 27527
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/PeriodicRecovery.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java
Log:
https://jira.jboss.org/jira/browse/JBTM-576
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 2009-07-04 08:11:03 UTC (rev 27526)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java 2009-07-04 08:14:17 UTC (rev 27527)
@@ -43,7 +43,6 @@
import com.arjuna.ats.arjuna.exceptions.FatalError;
import com.arjuna.ats.arjuna.common.recoveryPropertyManager;
import com.arjuna.common.util.propertyservice.PropertyManager;
-import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
/**
* @message com.arjuna.ats.arjuna.recovery.RecoveryManager_1 [com.arjuna.ats.arjuna.recovery.RecoveryManager_1] - Invalid recovery manager port specified {0}
@@ -371,6 +370,19 @@
}
/**
+ * Remove all modules.
+ *
+ * WARNING: Use with extreme care as this will stop recovery from doing anything!
+ */
+
+ public final void removeAllModules (boolean waitOnScan)
+ {
+ checkState();
+
+ _theImple.removeAllModules(waitOnScan);
+ }
+
+ /**
* Obtain a snapshot list of available recovery modules.
*
* @return a snapshot list of the currently installed recovery modules
@@ -520,8 +532,8 @@
System.out.println("Ready");
}
- // this is never going to return because it only returns when shutdon is called and
- // there is nothing which is going to call shutdown. we probably oght to provide a
+ // this is never going to return because it only returns when shutdown is called and
+ // there is nothing which is going to call shutdown. we probably aught to provide a
// clean way of terminating this process.
manager.waitForTermination();
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java 2009-07-04 08:11:03 UTC (rev 27526)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java 2009-07-04 08:14:17 UTC (rev 27527)
@@ -576,7 +576,6 @@
tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
FacilityCode.FAC_CRASH_RECOVERY, "PeriodicRecovery: removing module " + module.getClass().getName());
}
- _recoveryModules.remove(module);
if (waitOnScan) {
// make sure any scan which might be using the module has completed
@@ -584,7 +583,35 @@
doScanningWait();
}
}
+
+ // now remove it.
+
+ _recoveryModules.remove(module);
}
+
+ /**
+ * Remove all modules.
+ *
+ * @param waitOnScan true if the remove operation should wait for any in-progress scan to complete.
+ */
+
+ public final void removeAllModules (boolean waitOnScan)
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY, "PeriodicRecovery: removing all modules.");
+ }
+
+ if (waitOnScan) {
+ // make sure any scan which might be using the module has completed
+ synchronized (_stateLock) {
+ doScanningWait();
+ }
+ }
+
+ _recoveryModules.clear();
+ }
/**
* return a copy of the current recovery modules list
@@ -1108,7 +1135,6 @@
String backoffPeriodString=
arjPropertyManager.getPropertyManager().getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_BACKOFF_PERIOD);
-
if (backoffPeriodString != null)
{
try
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 2009-07-04 08:11:03 UTC (rev 27526)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java 2009-07-04 08:14:17 UTC (rev 27527)
@@ -34,12 +34,9 @@
import java.io.IOException;
import java.util.Vector;
-import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
-
import com.arjuna.ats.arjuna.common.arjPropertyManager;
import com.arjuna.ats.arjuna.common.Environment;
import com.arjuna.ats.arjuna.exceptions.FatalError;
-import com.arjuna.ats.arjuna.recovery.RecoveryConfiguration;
import com.arjuna.ats.arjuna.recovery.RecoveryModule;
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
import com.arjuna.ats.arjuna.logging.FacilityCode;
@@ -204,6 +201,11 @@
_periodicRecovery.removeModule(module, waitOnScan);
}
+ public final void removeAllModules (boolean waitOnScan)
+ {
+ _periodicRecovery.removeAllModules(waitOnScan);
+ }
+
public final Vector getModules ()
{
return _periodicRecovery.getModules();
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java 2009-07-04 08:11:03 UTC (rev 27526)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/CallbackRecoveryTest.java 2009-07-04 08:14:17 UTC (rev 27527)
@@ -31,6 +31,8 @@
package com.hp.mwtests.ts.arjuna.recovery;
+import com.arjuna.ats.arjuna.common.Environment;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
import com.arjuna.ats.arjuna.recovery.*;
import org.junit.Test;
@@ -44,7 +46,6 @@
}
public boolean passed = false;
-
}
public class CallbackRecoveryTest
@@ -52,20 +53,32 @@
@Test
public void test()
{
+ arjPropertyManager.getPropertyManager().setProperty(Environment.RECOVERY_BACKOFF_PERIOD, "1");
+
RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT);
DummyRecoveryModule module = new DummyRecoveryModule();
RecoveryScanImple rs = new RecoveryScanImple();
+ // make sure no other modules registered for this test
+
+ manager.removeAllModules(false);
+
manager.addModule(module);
manager.scan(rs);
- try {
- Thread.currentThread().sleep(120000);
+ // give enough time for both passes to run
+
+ try
+ {
+ Thread.sleep(2000);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
}
+ System.err.println("**checking");
+
assertTrue(module.finished());
assertTrue(rs.passed);
}
More information about the jboss-svn-commits
mailing list