[jboss-svn-commits] JBL Code SVN: r31481 - in labs/jbosstm/trunk/ArjunaCore/arjuna: classes/com/arjuna/ats/arjuna/coordinator and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Feb 7 16:22:37 EST 2010
Author: mark.little at jboss.com
Date: 2010-02-07 16:22:37 -0500 (Sun, 07 Feb 2010)
New Revision: 31481
Added:
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/AsyncUnitTest.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/TxStatsUnitTest.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/ExpiryScannerUnitTest.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryDriverUnitTest.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryManagerUnitTest.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryModuleUnitTest.java
Removed:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FdCache.java
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/ObjectStoreIterator.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryDriver.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/RecoveryMonitor.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/common/StateBean.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/LogWriteStateManager.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/classes/com/arjuna/ats/internal/arjuna/recovery/WorkerService.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/TypesUnitTest.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/ExtendedObject.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/statemanager/ExtendedUnitTest.java
Log:
https://jira.jboss.org/jira/browse/JBTM-698
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -549,7 +549,7 @@
* @return the type of the object (persistent, recoverable, ...)
*/
- public synchronized int ObjectType ()
+ public synchronized int objectType ()
{
return myType;
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -1019,6 +1019,268 @@
*/
/**
+ * Redefined version of save_state and restore_state from StateManager.
+ *
+ * Normal operation (no crashes):
+ *
+ * BasicAction.save_state is called after a successful prepare. This causes
+ * and BasicAction object to be saved in the object store. This object
+ * contains primarily the "intentions list" of the BasicAction. After
+ * successfully completing phase 2 of the commit protocol, the BasicAction
+ * object is deleted from the store.
+ *
+ * Failure cases:
+ *
+ * If a server crashes after successfully preparing, then upon recovery the
+ * action must be resolved (either committed or aborted) depending upon
+ * whether the co-ordinating atomic action committed or aborted. Upon server
+ * recovery, the crash recovery mechanism detects ServerBasicAction objects
+ * in the object store and attempts to activate the BasicAction object of
+ * the co-ordinating action. If this is successful then the SAA is committed
+ * else aborted.
+ *
+ * If, when processing phase 2 of the commit protocol, the co-ordinator
+ * experiences a failure to commit from one of the records then the
+ * BasicAction object is NOT deleted. It is rewritten when a new state which
+ * contains a list of the records that failed during phase 2 commit. This
+ * list is called the "failedList".
+ *
+ * The crash recovery manager will detect local BasicAction objects in
+ * addition to SAA objects in the objectstore. An attempt will be made to
+ * commit these actions. If the action contained a call to a now dead
+ * server, this action can never be resolved and the AA object can never be
+ * removed. However, if the action is purely local then after the processing
+ * is complete the removed by crash recovery.
+ *
+ * @return <code>true</code> if successful, <code>false</code>
+ * otherwise.
+ */
+
+ public boolean save_state (OutputObjectState os, int ot)
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "BasicAction::save_state ()");
+ }
+
+ try
+ {
+ packHeader(os, new Header(get_uid(), Utility.getProcessUid()));
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+
+ /*
+ * In a presumed abort scenario, this routine is called: a) After a
+ * successful prepare - to save the intentions list. b) After a failure
+ * during phase 2 of commit - to overwrite the intentions list by the
+ * failedList.
+ *
+ * If we're using presumed nothing, then it could be called: a) Whenever
+ * a participant is registered.
+ */
+
+ RecordList listToSave = null;
+ boolean res = true;
+
+ /*
+ * If we have a failedList then we are re-writing a BasicAction object
+ * after a failure during phase 2 commit
+ */
+
+ if ((failedList != null) && (failedList.size() > 0))
+ {
+ listToSave = failedList;
+ }
+ else
+ {
+ listToSave = preparedList;
+ }
+
+ AbstractRecord first = ((listToSave != null) ? listToSave.getFront()
+ : null);
+ AbstractRecord temp = first;
+ boolean havePacked = ((listToSave == null) ? false : true);
+
+ while ((res) && (temp != null))
+ {
+ listToSave.putRear(temp);
+
+ /*
+ * First check to see if we need to call save_state. If we do then
+ * we must first save the record type (and enum) and then save the
+ * unique identity of the record (a string). The former is needed to
+ * determine what type of record we are restoring, while the latter
+ * is required to re-create the actual record.
+ */
+
+ /*
+ * First check to see if we need to call save_state. If we do then
+ * we must first save the record type. This is used to determine
+ * which type of record to create when restoring.
+ */
+
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ if (temp.doSave())
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_14", new Object[]
+ { Integer.toString(temp.typeIs()), temp.type(), "true" });
+ else
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_14", new Object[]
+ { Integer.toString(temp.typeIs()), temp.type(), "false" });
+ }
+
+ if (temp.doSave())
+ {
+ res = true;
+
+ try
+ {
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_15", new Object[]
+ { Integer.toString(temp.typeIs()) });
+ }
+
+ os.packInt(temp.typeIs());
+ res = temp.save_state(os, ot);
+ }
+ catch (IOException e)
+ {
+ res = false;
+ }
+ }
+
+ temp = listToSave.getFront();
+
+ if (temp == first)
+ {
+ listToSave.putFront(temp);
+ temp = null;
+ }
+ }
+
+ /*
+ * If we only ever had a heuristic list (e.g., one-phase commit) then
+ * pack a record delimiter.
+ */
+
+ if (res && (os.notempty() || !havePacked))
+ {
+ try
+ {
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_16");
+ }
+
+ os.packInt(RecordType.NONE_RECORD);
+ }
+ catch (IOException e)
+ {
+ res = false;
+ }
+ }
+
+ if (res)
+ {
+ // Now deal with anything on the heuristic list!
+
+ int hSize = ((heuristicList == null) ? 0 : heuristicList.size());
+
+ try
+ {
+ os.packInt(hSize);
+ }
+ catch (IOException e)
+ {
+ res = false;
+ }
+
+ if (res && (hSize > 0))
+ {
+ first = heuristicList.getFront();
+ temp = first;
+
+ while (res && (temp != null))
+ {
+ heuristicList.putRear(temp);
+
+ if (temp.doSave())
+ {
+ res = true;
+
+ try
+ {
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_17", new Object[]
+ { Integer.toString(temp.typeIs()) });
+ }
+
+ os.packInt(temp.typeIs());
+ res = temp.save_state(os, ot);
+ }
+ catch (IOException e)
+ {
+ res = false;
+ }
+ }
+
+ temp = heuristicList.getFront();
+
+ if (temp == first)
+ {
+ heuristicList.putFront(temp);
+ temp = null;
+ }
+ }
+
+ if (res && os.notempty())
+ {
+ try
+ {
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_18");
+ }
+
+ os.packInt(RecordType.NONE_RECORD);
+ }
+ catch (IOException e)
+ {
+ res = false;
+ }
+ }
+ }
+ }
+
+ if (res && os.notempty())
+ {
+ try
+ {
+ if (tsLogger.arjLoggerI18N.isDebugEnabled())
+ {
+ tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_19", new Object[]
+ { ActionStatus.stringForm(actionStatus) });
+ }
+
+ os.packInt(actionStatus);
+ os.packInt(actionType); // why pack since only top-level?
+ os.packInt(heuristicDecision); // can we optimize?
+ }
+ catch (IOException e)
+ {
+ res = false;
+ }
+ }
+
+ return res;
+ }
+
+ /**
* Remove a child action.
*
* @return <code>true</code> if successful, <code>false</code>
@@ -1105,268 +1367,6 @@
}
/**
- * Redefined version of save_state and restore_state from StateManager.
- *
- * Normal operation (no crashes):
- *
- * BasicAction.save_state is called after a successful prepare. This causes
- * and BasicAction object to be saved in the object store. This object
- * contains primarily the "intentions list" of the BasicAction. After
- * successfully completing phase 2 of the commit protocol, the BasicAction
- * object is deleted from the store.
- *
- * Failure cases:
- *
- * If a server crashes after successfully preparing, then upon recovery the
- * action must be resolved (either committed or aborted) depending upon
- * whether the co-ordinating atomic action committed or aborted. Upon server
- * recovery, the crash recovery mechanism detects ServerBasicAction objects
- * in the object store and attempts to activate the BasicAction object of
- * the co-ordinating action. If this is successful then the SAA is committed
- * else aborted.
- *
- * If, when processing phase 2 of the commit protocol, the co-ordinator
- * experiences a failure to commit from one of the records then the
- * BasicAction object is NOT deleted. It is rewritten when a new state which
- * contains a list of the records that failed during phase 2 commit. This
- * list is called the "failedList".
- *
- * The crash recovery manager will detect local BasicAction objects in
- * addition to SAA objects in the objectstore. An attempt will be made to
- * commit these actions. If the action contained a call to a now dead
- * server, this action can never be resolved and the AA object can never be
- * removed. However, if the action is purely local then after the processing
- * is complete the removed by crash recovery.
- *
- * @return <code>true</code> if successful, <code>false</code>
- * otherwise.
- */
-
- public boolean save_state (OutputObjectState os, int ot)
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "BasicAction::save_state ()");
- }
-
- try
- {
- packHeader(os, new Header(get_uid(), Utility.getProcessUid()));
- }
- catch (IOException e)
- {
- return false;
- }
-
- /*
- * In a presumed abort scenario, this routine is called: a) After a
- * successful prepare - to save the intentions list. b) After a failure
- * during phase 2 of commit - to overwrite the intentions list by the
- * failedList.
- *
- * If we're using presumed nothing, then it could be called: a) Whenever
- * a participant is registered.
- */
-
- RecordList listToSave = null;
- boolean res = true;
-
- /*
- * If we have a failedList then we are re-writing a BasicAction object
- * after a failure during phase 2 commit
- */
-
- if ((failedList != null) && (failedList.size() > 0))
- {
- listToSave = failedList;
- }
- else
- {
- listToSave = preparedList;
- }
-
- AbstractRecord first = ((listToSave != null) ? listToSave.getFront()
- : null);
- AbstractRecord temp = first;
- boolean havePacked = ((listToSave == null) ? false : true);
-
- while ((res) && (temp != null))
- {
- listToSave.putRear(temp);
-
- /*
- * First check to see if we need to call save_state. If we do then
- * we must first save the record type (and enum) and then save the
- * unique identity of the record (a string). The former is needed to
- * determine what type of record we are restoring, while the latter
- * is required to re-create the actual record.
- */
-
- /*
- * First check to see if we need to call save_state. If we do then
- * we must first save the record type. This is used to determine
- * which type of record to create when restoring.
- */
-
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- if (temp.doSave())
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_14", new Object[]
- { Integer.toString(temp.typeIs()), temp.type(), "true" });
- else
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_14", new Object[]
- { Integer.toString(temp.typeIs()), temp.type(), "false" });
- }
-
- if (temp.doSave())
- {
- res = true;
-
- try
- {
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_15", new Object[]
- { Integer.toString(temp.typeIs()) });
- }
-
- os.packInt(temp.typeIs());
- res = temp.save_state(os, ot);
- }
- catch (IOException e)
- {
- res = false;
- }
- }
-
- temp = listToSave.getFront();
-
- if (temp == first)
- {
- listToSave.putFront(temp);
- temp = null;
- }
- }
-
- /*
- * If we only ever had a heuristic list (e.g., one-phase commit) then
- * pack a record delimiter.
- */
-
- if (res && (os.notempty() || !havePacked))
- {
- try
- {
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_16");
- }
-
- os.packInt(RecordType.NONE_RECORD);
- }
- catch (IOException e)
- {
- res = false;
- }
- }
-
- if (res)
- {
- // Now deal with anything on the heuristic list!
-
- int hSize = ((heuristicList == null) ? 0 : heuristicList.size());
-
- try
- {
- os.packInt(hSize);
- }
- catch (IOException e)
- {
- res = false;
- }
-
- if (res && (hSize > 0))
- {
- first = heuristicList.getFront();
- temp = first;
-
- while (res && (temp != null))
- {
- heuristicList.putRear(temp);
-
- if (temp.doSave())
- {
- res = true;
-
- try
- {
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_17", new Object[]
- { Integer.toString(temp.typeIs()) });
- }
-
- os.packInt(temp.typeIs());
- res = temp.save_state(os, ot);
- }
- catch (IOException e)
- {
- res = false;
- }
- }
-
- temp = heuristicList.getFront();
-
- if (temp == first)
- {
- heuristicList.putFront(temp);
- temp = null;
- }
- }
-
- if (res && os.notempty())
- {
- try
- {
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_18");
- }
-
- os.packInt(RecordType.NONE_RECORD);
- }
- catch (IOException e)
- {
- res = false;
- }
- }
- }
- }
-
- if (res && os.notempty())
- {
- try
- {
- if (tsLogger.arjLoggerI18N.isDebugEnabled())
- {
- tsLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, FacilityCode.FAC_ATOMIC_ACTION, "com.arjuna.ats.arjuna.coordinator.BasicAction_19", new Object[]
- { ActionStatus.stringForm(actionStatus) });
- }
-
- os.packInt(actionStatus);
- os.packInt(actionType); // why pack since only top-level?
- os.packInt(heuristicDecision); // can we optimize?
- }
- catch (IOException e)
- {
- res = false;
- }
- }
-
- return res;
- }
-
- /**
* This assumes the various lists are zero length when it is called.
*
* @return <code>true</code> if successful, <code>false</code>
@@ -1865,6 +1865,8 @@
if (!reportHeuristics && TxControl.asyncCommit
&& (parentAction == null))
{
+ System.err.println("**here");
+
AsyncCommit.create(this, true);
}
else
@@ -1874,9 +1876,17 @@
}
else
{
- ActionManager.manager().remove(get_uid());
-
- actionStatus = ActionStatus.COMMITTED;
+ ActionManager.manager().remove(get_uid());
+
+ actionStatus = ActionStatus.COMMITTED;
+
+ if (TxStats.enabled())
+ {
+ if (heuristicDecision != TwoPhaseOutcome.HEURISTIC_ROLLBACK)
+ {
+ TxStats.getInstance().incrementCommittedTransactions();
+ }
+ }
}
boolean returnCurrentStatus = false;
@@ -3469,6 +3479,11 @@
if (p == TwoPhaseOutcome.FINISH_OK)
{
+ // only count the first heuristic.
+
+ if (TxStats.enabled())
+ TxStats.getInstance().incrementHeuristics();
+
if (commit)
{
if (heuristicDecision == TwoPhaseOutcome.PREPARE_OK)
@@ -3538,9 +3553,6 @@
heuristicDecision = p; // anything!
break;
}
-
- if (TxStats.enabled())
- TxStats.getInstance().incrementHeuristics();
}
protected void updateState ()
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/ObjectStoreIterator.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/ObjectStoreIterator.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/objectstore/ObjectStoreIterator.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -79,6 +79,6 @@
return newUid;
}
- private InputObjectState uidList;
+ private InputObjectState uidList = new InputObjectState();
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryDriver.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryDriver.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryDriver.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -36,6 +36,10 @@
public class RecoveryDriver
{
+ public static final String SCAN = "SCAN";
+ public static final String ASYNC_SCAN = "ASYNC_SCAN";
+ public static final String PING = "PING";
+ public static final String PONG = "PONG";
public RecoveryDriver (int port)
{
@@ -56,12 +60,12 @@
public final boolean synchronousScan () throws java.net.UnknownHostException, java.net.SocketException, java.io.IOException
{
- return scan("SCAN");
+ return scan(SCAN);
}
public final boolean asynchronousScan () throws java.net.UnknownHostException, java.net.SocketException, java.io.IOException
{
- return scan("ASYNC_SCAN");
+ return scan(ASYNC_SCAN);
}
private final boolean scan (String scanType) throws java.net.UnknownHostException, java.net.SocketException, java.io.IOException
@@ -69,6 +73,8 @@
if (_hostName == null)
_hostName = InetAddress.getLocalHost().getHostName();
+ System.err.println("**binding "+_hostName+" "+_port);
+
Socket connectorSocket = new Socket(_hostName, _port);
connectorSocket.setSoTimeout(_timeout);
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/RecoveryMonitor.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/RecoveryMonitor.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/RecoveryMonitor.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -34,6 +34,8 @@
import java.io.*;
import java.net.*;
+import com.arjuna.ats.arjuna.recovery.RecoveryDriver;
+
public class RecoveryMonitor
{
@@ -131,9 +133,9 @@
PrintWriter toServer = new PrintWriter(new OutputStreamWriter(connectorSocket.getOutputStream()));
if (asyncScan)
- toServer.println("ASYNC_SCAN");
+ toServer.println(RecoveryDriver.ASYNC_SCAN);
else
- toServer.println("SCAN");
+ toServer.println(RecoveryDriver.SCAN);
toServer.flush() ;
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/common/StateBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/common/StateBean.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/tools/osb/mbean/common/StateBean.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -96,7 +96,7 @@
public String getObjectType()
{
- return ObjectType.toString(info.ObjectType());
+ return ObjectType.toString(info.objectType());
}
class StateManagerInfo extends StateManager
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/LogWriteStateManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/LogWriteStateManager.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/LogWriteStateManager.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -99,12 +99,12 @@
FacilityCode.FAC_STATE_MAN, "StateManager::modified() for object-id "+get_uid());
}
- if ((super.ObjectType() == ObjectType.RECOVERABLE) && (super.objectModel == ObjectModel.SINGLE))
+ if ((super.objectType() == ObjectType.RECOVERABLE) && (super.objectModel == ObjectModel.SINGLE))
return super.modified();
BasicAction action = BasicAction.Current();
- if ((super.ObjectType() == ObjectType.NEITHER) || (super.status() == ObjectStatus.DESTROYED)) /* NEITHER => no recovery info */
+ if ((super.objectType() == ObjectType.NEITHER) || (super.status() == ObjectStatus.DESTROYED)) /* NEITHER => no recovery info */
{
return true;
}
Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FdCache.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FdCache.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/objectstore/FdCache.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -1,93 +0,0 @@
-/*
- * 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 in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: FdCache.java 2342 2006-03-30 13:06:17Z $
- */
-
-package com.arjuna.ats.internal.arjuna.objectstore;
-
-import com.arjuna.ats.arjuna.common.Uid;
-import java.io.*;
-
-class CacheEntry
-{
-
-public void CacheEntry (File f)
- {
- _theFile = f;
- }
-
-public File file ()
- {
- return _theFile;
- }
-
-CacheEntry _next;
-CacheEntry _prev;
-
-private File _theFile;
-
-}
-
-class FdCache
-{
-
-public FdCache ()
- {
- this(FdCache.cacheSize);
- }
-
-public FdCache (int size)
- {
- _head = _tail = null;
- }
-
-/* XXX: Not yet finished
-public synchronized File scanCache (Uid u)
- {
- }
-
-public synchronized File enterIntoCache (Uid u)
- {
- }
-
-public void purgeFromCache (Uid u)
- {
- }
-
-private boolean compactCache ()
- {
- }
-*/
-
-private CacheEntry _head;
-private CacheEntry _tail;
-
-private static final int cacheSize = 256;
-
-}
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 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -324,7 +324,11 @@
synchronized (_socketLock)
{
if (_socket == null)
+ {
_socket = new ServerSocket(RecoveryManager.getRecoveryManagerPort(), Utility.BACKLOG, RecoveryManager.getRecoveryManagerHost());
+
+ recoveryPropertyManager.getRecoveryEnvironmentBean().setRecoveryPort(_socket.getLocalPort());
+ }
return _socket;
}
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-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -38,7 +38,6 @@
import com.arjuna.ats.arjuna.exceptions.FatalError;
import com.arjuna.ats.arjuna.recovery.RecoveryModule;
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
import com.arjuna.ats.arjuna.logging.tsLogger;
/**
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/WorkerService.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/WorkerService.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/WorkerService.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -32,6 +32,7 @@
package com.arjuna.ats.internal.arjuna.recovery;
import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.recovery.RecoveryDriver;
import com.arjuna.ats.arjuna.recovery.Service;
import java.io.*;
@@ -64,14 +65,14 @@
out.println("PONG");
}
else
- if (request.equals("SCAN") || (request.equals("ASYNC_SCAN")))
+ if (request.equals(RecoveryDriver.SCAN) || (request.equals(RecoveryDriver.ASYNC_SCAN)))
{
// hmm, we need to synchronize on the periodic recovery object in order to wake it up via notify.
// but the periodic recovery object has to synchronize on this object and then call notify
// in order to tell it that the last requested scan has completed. i.e. we have a two way
// wakeup here. so we have to be careful to avoid a deadlock.
- if (request.equals("SCAN")) {
+ if (request.equals(RecoveryDriver.SCAN)) {
// do this before kicking the periodic recovery thread
synchronized (this) {
doWait = true;
@@ -82,7 +83,7 @@
tsLogger.arjLoggerI18N.info("com.arjuna.ats.internal.arjuna.recovery.WorkerService_3");
- if (request.equals("SCAN"))
+ if (request.equals(RecoveryDriver.SCAN))
{
synchronized (this) {
if (doWait) {
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/AsyncUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/AsyncUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/AsyncUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -0,0 +1,82 @@
+/*
+ * 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 in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.ts.arjuna.atomicaction;
+
+import com.arjuna.ats.arjuna.AtomicAction;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
+import com.hp.mwtests.ts.arjuna.resources.BasicRecord;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AsyncUnitTest
+{
+ @Test
+ public void testAsyncPrepare () throws Exception
+ {
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncPrepare(true);
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncCommit(true);
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncRollback(true);
+
+ AtomicAction A = new AtomicAction();
+
+ A.begin();
+
+ A.add(new BasicRecord());
+ A.add(new BasicRecord());
+
+ A.commit(false);
+ }
+
+ @Test
+ public void testAsyncCommit () throws Exception
+ {
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncPrepare(true);
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncCommit(true);
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncRollback(true);
+
+ AtomicAction A = new AtomicAction();
+
+ A.begin();
+
+ A.add(new BasicRecord());
+ A.add(new BasicRecord());
+
+ A.commit(false);
+ }
+
+ @Test
+ public void testAsyncAbort () throws Exception
+ {
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncPrepare(true);
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncCommit(true);
+ arjPropertyManager.getCoordinatorEnvironmentBean().setAsyncRollback(true);
+
+ AtomicAction A = new AtomicAction();
+
+ A.begin();
+
+ A.add(new BasicRecord());
+ A.add(new BasicRecord());
+
+ A.abort();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/TxStatsUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/TxStatsUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/TxStatsUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -0,0 +1,82 @@
+/*
+ * 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 in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.ts.arjuna.atomicaction;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import com.arjuna.ats.arjuna.AtomicAction;
+import com.arjuna.ats.arjuna.TopLevelAction;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
+import com.arjuna.ats.arjuna.coordinator.ActionStatus;
+import com.arjuna.ats.arjuna.coordinator.TxStats;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class TxStatsUnitTest
+{
+ @Test
+ public void test() throws Exception
+ {
+ arjPropertyManager.getCoordinatorEnvironmentBean().setEnableStatistics(true);
+
+ for (int i = 0; i < 100; i++)
+ {
+ AtomicAction A = new AtomicAction();
+ AtomicAction B = new AtomicAction();
+
+ A.begin();
+ B.begin();
+
+ B.commit();
+ A.commit();
+ }
+
+ for (int i = 0; i < 100; i++)
+ {
+ AtomicAction A = new AtomicAction();
+
+ A.begin();
+
+ A.abort();
+ }
+
+ AtomicAction B = new AtomicAction();
+
+ B.begin();
+
+ assertTrue(TxStats.enabled());
+ assertEquals(TxStats.getInstance().getNumberOfAbortedTransactions(), 100);
+ assertEquals(TxStats.getInstance().getNumberOfApplicationRollbacks(), 100);
+ assertEquals(TxStats.getInstance().getNumberOfCommittedTransactions(), 200);
+ assertEquals(TxStats.getInstance().getNumberOfHeuristics(), 0);
+ assertEquals(TxStats.getInstance().getNumberOfInflightTransactions(), 1);
+ assertEquals(TxStats.getInstance().getNumberOfNestedTransactions(), 100);
+ assertEquals(TxStats.getInstance().getNumberOfResourceRollbacks(), 0);
+ assertEquals(TxStats.getInstance().getNumberOfTimedOutTransactions(), 0);
+ assertEquals(TxStats.getInstance().getNumberOfTransactions(), 301);
+
+ PrintWriter pw = new PrintWriter(new StringWriter());
+
+ TxStats.getInstance().printStatus(pw);
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/TypesUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/TypesUnitTest.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/TypesUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -28,8 +28,15 @@
import com.arjuna.ats.arjuna.ObjectModel;
import com.arjuna.ats.arjuna.ObjectStatus;
import com.arjuna.ats.arjuna.ObjectType;
+import com.arjuna.ats.arjuna.coordinator.ActionStatus;
+import com.arjuna.ats.arjuna.coordinator.ActionType;
+import com.arjuna.ats.arjuna.coordinator.AddOutcome;
+import com.arjuna.ats.arjuna.coordinator.RecordType;
+import com.arjuna.ats.arjuna.coordinator.TwoPhaseOutcome;
import com.arjuna.ats.arjuna.objectstore.StateStatus;
import com.arjuna.ats.arjuna.objectstore.StateType;
+import com.arjuna.ats.internal.arjuna.abstractrecords.ActivationRecord;
+import com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord;
import static org.junit.Assert.*;
@@ -89,4 +96,59 @@
assertEquals(StateType.stateTypeString(StateType.OS_ORIGINAL), "StateType.OS_ORIGINAL");
}
+
+ @Test
+ public void testActionType ()
+ {
+ PrintWriter pw = new PrintWriter(new StringWriter());
+
+ ActionType.print(pw, ActionType.NESTED);
+ }
+
+ @Test
+ public void testAddOutcome ()
+ {
+ PrintWriter pw = new PrintWriter(new StringWriter());
+
+ AddOutcome.print(pw, AddOutcome.AR_ADDED);
+
+ assertEquals(AddOutcome.printString(AddOutcome.AR_DUPLICATE), "AddOutcome.AR_DUPLICATE");
+ }
+
+ @Test
+ public void testTwoPhaseOutcome ()
+ {
+ PrintWriter pw = new PrintWriter(new StringWriter());
+
+ TwoPhaseOutcome.print(pw, TwoPhaseOutcome.FINISH_ERROR);
+
+ assertEquals(TwoPhaseOutcome.stringForm(TwoPhaseOutcome.FINISH_OK), "TwoPhaseOutcome.FINISH_OK");
+
+ TwoPhaseOutcome o = new TwoPhaseOutcome(TwoPhaseOutcome.HEURISTIC_COMMIT);
+
+ o.setOutcome(TwoPhaseOutcome.NOT_PREPARED);
+
+ assertEquals(o.getOutcome(), TwoPhaseOutcome.NOT_PREPARED);
+ }
+
+ @Test
+ public void testActionStatus ()
+ {
+ PrintWriter pw = new PrintWriter(new StringWriter());
+
+ ActionStatus.print(pw, ActionStatus.ABORT_ONLY);
+
+ assertEquals(ActionStatus.stringForm(ActionStatus.ABORTED), "ActionStatus.ABORTED");
+ }
+
+ @Test
+ public void testRecordType ()
+ {
+ PrintWriter pw = new PrintWriter(new StringWriter());
+
+ RecordType.print(pw, RecordType.ACTIVATION);
+
+ assertEquals(RecordType.classToType(PersistenceRecord.class), RecordType.PERSISTENCE);
+ assertEquals(RecordType.typeToClass(RecordType.ACTIVATION), ActivationRecord.class);
+ }
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/objectstore/ObjectStoreTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -33,8 +33,10 @@
import com.arjuna.ats.arjuna.common.Uid;
import com.arjuna.ats.arjuna.common.arjPropertyManager;
+import com.arjuna.ats.arjuna.coordinator.TxControl;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.arjuna.objectstore.ObjectStoreIterator;
import com.arjuna.ats.arjuna.objectstore.ObjectStoreType;
import com.arjuna.ats.arjuna.objectstore.StateStatus;
import com.arjuna.ats.arjuna.objectstore.StateType;
@@ -405,6 +407,25 @@
assertTrue(as.lock());
assertTrue(as.unlock());
}
+
+ @Test
+ public void testIterator () throws Exception
+ {
+ Uid u1 = new Uid();
+ Uid u2 = new Uid();
+
+ TxControl.getStore().write_committed(u1, "foo", new OutputObjectState());
+ TxControl.getStore().write_committed(u2, "foo", new OutputObjectState());
+
+ ObjectStoreIterator iter = new ObjectStoreIterator(TxControl.getStore(), "foo");
+ Uid x = iter.iterate();
+
+ assertTrue(x.notEquals(Uid.nullUid()));
+ assertTrue(x.equals(u1));
+
+ assertTrue(iter.iterate().notEquals(Uid.nullUid()));
+ assertTrue(iter.iterate().equals(Uid.nullUid()));
+ }
private static final boolean validate(ObjectStore objStore)
{
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/ExpiryScannerUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/ExpiryScannerUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/ExpiryScannerUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -0,0 +1,40 @@
+/*
+ * 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 in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.ts.arjuna.recovery;
+
+import org.junit.Test;
+
+import com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner;
+
+import static org.junit.Assert.*;
+
+public class ExpiryScannerUnitTest
+{
+ @Test
+ public void test () throws Exception
+ {
+ ExpiredTransactionStatusManagerScanner et = new ExpiredTransactionStatusManagerScanner();
+
+ assertTrue(et.toBeUsed());
+
+ et.scan();
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryDriverUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryDriverUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryDriverUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -0,0 +1,71 @@
+/*
+ * 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 in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.ts.arjuna.recovery;
+
+import com.arjuna.ats.arjuna.common.*;
+import com.arjuna.ats.arjuna.recovery.RecoveryDriver;
+import com.arjuna.ats.arjuna.recovery.RecoveryManager;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class RecoveryDriverUnitTest
+{
+ @Test
+ public void testInvalid () throws Exception
+ {
+ RecoveryDriver rd = new RecoveryDriver(0, "foobar");
+
+ try
+ {
+ rd.asynchronousScan();
+
+ fail();
+ }
+ catch (final Exception ex)
+ {
+ }
+
+ try
+ {
+ rd.synchronousScan();
+
+ fail();
+ }
+ catch (final Exception ex)
+ {
+ }
+ }
+
+ @Test
+ public void testValid () throws Exception
+ {
+ RecoveryManager rm = RecoveryManager.manager();
+
+ rm.scan(null);
+
+ RecoveryDriver rd = new RecoveryDriver(RecoveryManager.getRecoveryManagerPort(), recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryAddress());
+
+ assertTrue(rd.asynchronousScan());
+ assertTrue(rd.synchronousScan());
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryManagerUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryManagerUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryManagerUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -0,0 +1,50 @@
+/*
+ * 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 in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.ts.arjuna.recovery;
+
+import com.arjuna.ats.arjuna.common.*;
+import com.arjuna.ats.arjuna.recovery.RecoveryDriver;
+import com.arjuna.ats.arjuna.recovery.RecoveryManager;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class RecoveryManagerUnitTest
+{
+ @Test
+ public void testSuspendResume () throws Exception
+ {
+ RecoveryManager rm = RecoveryManager.manager();
+
+ rm.scan(null);
+
+ rm.suspend(false);
+ rm.resume();
+
+ assertTrue(rm.getModules() != null);
+
+ rm.removeModule(null, true);
+ rm.removeAllModules(true);
+
+ rm.terminate(false);
+ }
+}
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryModuleUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryModuleUnitTest.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/recovery/RecoveryModuleUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -0,0 +1,39 @@
+/*
+ * 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 in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.hp.mwtests.ts.arjuna.recovery;
+
+import org.junit.Test;
+
+import com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule;
+
+import static org.junit.Assert.*;
+
+public class RecoveryModuleUnitTest
+{
+ @Test
+ public void testAA () throws Exception
+ {
+ AtomicActionRecoveryModule aarm = new AtomicActionRecoveryModule();
+
+ aarm.periodicWorkFirstPass();
+ aarm.periodicWorkSecondPass();
+ }
+}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/ExtendedObject.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/ExtendedObject.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/resources/ExtendedObject.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -67,6 +67,16 @@
getMutex().unlock();
}
+
+ public boolean lock ()
+ {
+ return super.tryLockMutex();
+ }
+
+ public boolean unlock ()
+ {
+ return super.unlockMutex();
+ }
public void incr(int value)
{
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/statemanager/ExtendedUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/statemanager/ExtendedUnitTest.java 2010-02-07 17:28:21 UTC (rev 31480)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/statemanager/ExtendedUnitTest.java 2010-02-07 21:22:37 UTC (rev 31481)
@@ -31,8 +31,12 @@
package com.hp.mwtests.ts.arjuna.statemanager;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
import com.arjuna.ats.arjuna.AtomicAction;
import com.arjuna.ats.arjuna.ObjectStatus;
+import com.arjuna.ats.arjuna.ObjectType;
import com.arjuna.ats.arjuna.common.Uid;
import com.hp.mwtests.ts.arjuna.resources.*;
@@ -64,6 +68,12 @@
assertEquals(bo.status(), ObjectStatus.PASSIVE);
assertTrue(bo.getStore() != null);
assertTrue(bo.getStoreRoot() != null);
+
+ assertEquals(bo.objectType(), ObjectType.ANDPERSISTENT);
+
+ PrintWriter pw = new PrintWriter(new StringWriter());
+
+ bo.print(pw);
}
@Test
@@ -84,4 +94,13 @@
B.commit();
A.commit();
}
+
+ @Test
+ public void tryLock () throws Exception
+ {
+ ExtendedObject bo = new ExtendedObject();
+
+ assertTrue(bo.lock());
+ assertTrue(bo.unlock());
+ }
}
More information about the jboss-svn-commits
mailing list