[jboss-svn-commits] JBL Code SVN: r30191 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 17 08:51:01 EST 2009
Author: mark.little at jboss.com
Date: 2009-11-17 08:51:00 -0500 (Tue, 17 Nov 2009)
New Revision: 30191
Added:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/Header.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/coordinator/TwoPhaseCoordinator.java
labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/recovery/RecoveredTransactionalObject.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredServerTransaction.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredTransaction.java
Log:
https://jira.jboss.org/jira/browse/JBTM-623
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 2009-11-17 12:07:01 UTC (rev 30190)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -46,6 +46,7 @@
import com.arjuna.ats.arjuna.logging.FacilityCode;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.internal.arjuna.Header;
import com.arjuna.ats.internal.arjuna.abstractrecords.ActivationRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.CadaverActivationRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.CadaverRecord;
@@ -139,9 +140,9 @@
BasicAction action = BasicAction.Current();
if (action == null)
- packHeader(os, null, Utility.getProcessUid());
+ packHeader(os, new Header(null, Utility.getProcessUid()));
else
- packHeader(os, action.get_uid(), Utility.getProcessUid());
+ packHeader(os, new Header(action.get_uid(), Utility.getProcessUid()));
}
catch (IOException e)
{
@@ -168,10 +169,7 @@
{
try
{
- Uid txId = new Uid(Uid.nullUid());
- Uid processUid = new Uid(Uid.nullUid());
-
- unpackHeader(os, txId, processUid);
+ unpackHeader(os, new Header());
}
catch (IOException e)
{
@@ -721,7 +719,7 @@
* @since JTS 2.1.
*/
- protected void packHeader (OutputObjectState os, Uid txId, Uid processUid)
+ protected void packHeader (OutputObjectState os, Header hdr)
throws IOException
{
/*
@@ -729,6 +727,9 @@
* JVM and the tx id. Otherwise pack a null Uid.
*/
+ Uid txId = ((hdr == null) ? null : hdr.getTxId());
+ Uid processUid = ((hdr == null) ? null : hdr.getProcessId());
+
try
{
// pack the marker first.
@@ -782,11 +783,17 @@
* be written to the object store.
*/
- protected void unpackHeader (InputObjectState os, Uid txId, Uid processUid)
+ protected void unpackHeader (InputObjectState os, Header hdr)
throws IOException
{
try
{
+ if (hdr == null)
+ throw new NullPointerException();
+
+ Uid txId = null;
+ Uid processUid = null;
+
String myState = os.unpackString();
if (myState.equals(StateManager.marker))
@@ -821,12 +828,15 @@
"StateManager.unpackHeader for object-id " + get_uid()
+ " birth-date " + birthDate);
}
+
+ hdr.setTxId(txId);
+ hdr.setProcessId(processUid);
}
catch (IOException ex)
{
throw ex;
}
- catch (Exception e)
+ catch (final Throwable e)
{
IOException ioException = new IOException(e.toString());
ioException.initCause(e);
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 2009-11-17 12:07:01 UTC (rev 30190)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -40,6 +40,7 @@
import com.arjuna.ats.arjuna.objectstore.ObjectStore;
import com.arjuna.ats.arjuna.utils.ThreadUtil;
import com.arjuna.ats.arjuna.utils.Utility;
+import com.arjuna.ats.internal.arjuna.Header;
import com.arjuna.ats.internal.arjuna.coordinator.CheckedActionFactoryImple;
import com.arjuna.ats.internal.arjuna.thread.*;
import java.util.*;
@@ -1145,7 +1146,7 @@
try
{
- packHeader(os, get_uid(), Utility.getProcessUid());
+ packHeader(os, new Header(get_uid(), Utility.getProcessUid()));
}
catch (IOException e)
{
@@ -1390,10 +1391,9 @@
try
{
- Uid txId = new Uid(Uid.nullUid());
- Uid processUid = new Uid(Uid.nullUid());
+ Header hdr = new Header();
- unpackHeader(os, txId, processUid);
+ unpackHeader(os, hdr);
}
catch (IOException e)
{
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java 2009-11-17 12:07:01 UTC (rev 30190)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -125,6 +125,8 @@
int result = AddOutcome.AR_REJECTED;
+ // only allow registration for top-level transactions.
+
if (parent() != null)
return AddOutcome.AR_REJECTED;
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/Header.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/Header.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/Header.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -0,0 +1,77 @@
+/*
+ * 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) 2005,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: LogWriteStateManager.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.arjuna.ats.internal.arjuna;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+/**
+ * @author Mark Little (mark at arjuna.com)
+ * @since JBTM 4.9.0.
+ */
+
+public class Header
+{
+ public Header ()
+ {
+ _txId = null;
+ _processId = null;
+ }
+
+ public Header (Uid txId, Uid processId)
+ {
+ _txId = txId;
+ _processId = processId;
+ }
+
+ public Uid getTxId ()
+ {
+ return _txId;
+ }
+
+ public Uid getProcessId ()
+ {
+ return _processId;
+ }
+
+ public void setTxId (Uid txId)
+ {
+ _txId = txId;
+ }
+
+ public void setProcessId (Uid processId)
+ {
+ _processId = processId;
+ }
+
+ private Uid _txId;
+ private Uid _processId;
+}
Modified: labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/recovery/RecoveredTransactionalObject.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/recovery/RecoveredTransactionalObject.java 2009-11-17 12:07:01 UTC (rev 30190)
+++ labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/recovery/RecoveredTransactionalObject.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -47,236 +47,324 @@
import java.io.PrintWriter;
import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.internal.arjuna.Header;
+
import java.io.IOException;
/**
- * TransactionalObject shell instantiated at recovery time.
- * <p>Instantiated only for
- * TransactionalObjects that are found (by {@link TORecoveryModule}) to be in
- * an uncommitted (indeterminate) state. The status of the transaction that
- * created the uncommitted state is determined - if the transaction rolled
- * back, the original state of the TransactionalObject is
- * reinstated. If the transaction rolled back (or is still in progress), no
+ * TransactionalObject shell instantiated at recovery time.
+ * <p>
+ * Instantiated only for TransactionalObjects that are found (by
+ * {@link TORecoveryModule}) to be in an uncommitted (indeterminate) state. The
+ * status of the transaction that created the uncommitted state is determined -
+ * if the transaction rolled back, the original state of the TransactionalObject
+ * is reinstated. If the transaction rolled back (or is still in progress), no
* change is made - the completion (including completion in recovery) of the
* transaction will be applied to the transactional object (eventually).
- * <p>Instantiation from the ObjectStore ignores all of the TO except for the
- * information in the header
- * ( see {@link com.arjuna.ats.arjuna.StateManager#packHeader StateManager.packHeader}),
- * which is overridden by this class).
+ * <p>
+ * Instantiation from the ObjectStore ignores all of the TO except for the
+ * information in the header ( see
+ * {@link com.arjuna.ats.arjuna.StateManager#packHeader StateManager.packHeader}
+ * ), which is overridden by this class).
* <P>
- * @author Peter Furniss (peter.furniss at arjuna.com), Mark Little (mark_little at hp.com)
- * @version $Id: RecoveredTransactionalObject.java 2342 2006-03-30 13:06:17Z $
- *
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_1 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_1] - RecoveredTransactionalObject created for {0}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_2 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_2] - TO held by transaction {0}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_3 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_3] - transaction status {0}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_4 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_4] - transaction Status from original application {0} and inactive: {1}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_5 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_5] - RecoveredTransactionalObject.replayPhase2 - cannot find/no holding transaction
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_6 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_6] - RecoveredTransactionalObject tried to access object store {0}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_7 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_7] - RecoveredTransactionalObject::findHoldingTransaction - uid is {0}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_8 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_8] - RecoveredTransactionalObject::findHoldingTransaction - exception {0}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_9 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_9] - Object store exception on removing uncommitted state: {0} {1}
- * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_10 [com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_10] - Object store exception on committing {0} {1}
+ *
+ * @author Peter Furniss (peter.furniss at arjuna.com), Mark Little
+ * (mark_little at hp.com)
+ * @version $Id: RecoveredTransactionalObject.java 2342 2006-03-30 13:06:17Z $
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_1
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_1] - RecoveredTransactionalObject
+ * created for {0}
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_2
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_2] - TO held by transaction {0}
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_3
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_3] - transaction status {0}
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_4
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_4] - transaction Status from original
+ * application {0} and inactive: {1}
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_5
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_5] -
+ * RecoveredTransactionalObject.replayPhase2 - cannot find/no holding
+ * transaction
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_6
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_6] - RecoveredTransactionalObject tried
+ * to access object store {0}
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_7
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_7] -
+ * RecoveredTransactionalObject::findHoldingTransaction - uid is {0}
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_8
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_8] -
+ * RecoveredTransactionalObject::findHoldingTransaction - exception {0}
+ * @message com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_9
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_9] - Object store exception on removing
+ * uncommitted state: {0} {1}
+ * @message
+ * com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_10
+ * [com.arjuna.ats.internal.txoj.recovery.
+ * RecoveredTransactionalObject_10] - Object store exception on
+ * committing {0} {1}
*/
/*
- * Does not extend LockManager or StateManager because they are concerned with
+ * Does not extend LockManager or StateManager because they are concerned with
* activating the committed state, and this is only concerned with the
* uncommitted.
*/
-
+
public class RecoveredTransactionalObject extends StateManager
{
-RecoveredTransactionalObject (Uid objectUid, String originalType,
- ObjectStore objectStore)
+ RecoveredTransactionalObject(Uid objectUid, String originalType,
+ ObjectStore objectStore)
{
- _ourUid = objectUid;
- _type = originalType;
- _objectStore = objectStore;
- _transactionStatusConnectionMgr = new TransactionStatusConnectionManager() ;
-
- if (txojLogger.aitLoggerI18N.isDebugEnabled())
- {
- txojLogger.aitLoggerI18N.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PACKAGE,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_1",
- new Object[]{_ourUid});
- }
+ _ourUid = objectUid;
+ _type = originalType;
+ _objectStore = objectStore;
+ _transactionStatusConnectionMgr = new TransactionStatusConnectionManager();
+
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PACKAGE,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_1",
+ new Object[]
+ { _ourUid });
+ }
}
-
-final void replayPhase2 ()
+
+ final void replayPhase2 ()
{
- if (findHoldingTransaction())
- {
- /*
- * There is a transaction holding this in uncommitted state
- * find out what the Status is.
- *
- * We have no idea what type of transaction it is, so leave
- * that to the cache.
- */
+ if (findHoldingTransaction())
+ {
+ /*
+ * There is a transaction holding this in uncommitted state find out
+ * what the Status is. We have no idea what type of transaction it
+ * is, so leave that to the cache.
+ */
- if (txojLogger.aitLoggerI18N.isDebugEnabled())
- {
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_2",
- new Object[]{_owningTransactionUid});
- }
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_2",
+ new Object[]
+ { _owningTransactionUid });
+ }
- int tranStatus = _transactionStatusConnectionMgr.getTransactionStatus(_owningTransactionUid);
+ int tranStatus = _transactionStatusConnectionMgr
+ .getTransactionStatus(_owningTransactionUid);
- if (txojLogger.aitLoggerI18N.isDebugEnabled())
- {
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_3",
- new Object[]{ActionStatus.stringForm(tranStatus)});
- }
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_3",
+ new Object[]
+ { ActionStatus.stringForm(tranStatus) });
+ }
- boolean inactive = false;
-
- if (tranStatus == ActionStatus.INVALID) // should be ActionStatus.NO_ACTION
- {
- if (txojLogger.aitLoggerI18N.isDebugEnabled())
- {
- if (inactive)
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_4", new Object[]{Integer.toString(tranStatus), "true"});
- else
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_4", new Object[]{Integer.toString(tranStatus), "false"});
- }
-
- inactive = true;
- }
+ boolean inactive = false;
- /*
- * Only do anything if we are sure the transaction rolledback
- * if it is still in progress in the original application, let
- * that run otherwise the transaction should recover and do the
- * committment eventually.
- */
+ if (tranStatus == ActionStatus.INVALID) // should be
+ // ActionStatus.NO_ACTION
+ {
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ if (inactive)
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_4",
+ new Object[]
+ { Integer.toString(tranStatus), "true" });
+ else
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_4",
+ new Object[]
+ { Integer.toString(tranStatus), "false" });
+ }
- if ((tranStatus == ActionStatus.ABORTED) || inactive)
- {
- rollback();
- }
- }
- else
- {
- if (txojLogger.aitLoggerI18N.isDebugEnabled())
- {
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_5");
- }
- }
+ inactive = true;
+ }
+
+ /*
+ * Only do anything if we are sure the transaction rolledback if it
+ * is still in progress in the original application, let that run
+ * otherwise the transaction should recover and do the committment
+ * eventually.
+ */
+
+ if ((tranStatus == ActionStatus.ABORTED) || inactive)
+ {
+ rollback();
+ }
+ }
+ else
+ {
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_5");
+ }
+ }
}
-
+
/**
- * Determine which transaction got this into uncommitted state
- * return true if there is such a transaction
+ * Determine which transaction got this into uncommitted state return true
+ * if there is such a transaction
*/
-private final boolean findHoldingTransaction ()
+ private final boolean findHoldingTransaction ()
{
- InputObjectState uncommittedState = null;
-
- _originalProcessUid = new Uid(Uid.nullUid());
-
- try
- {
- uncommittedState = _objectStore.read_uncommitted(_ourUid, _type);
- }
- catch (ObjectStoreException e)
- {
- if (txojLogger.aitLoggerI18N.isDebugEnabled())
- {
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PACKAGE,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_6",
- new Object[]{e});
- }
-
- return false; // probably
- }
+ InputObjectState uncommittedState = null;
- /*
- * Get the transaction and original process information from the
- * saved state.
- */
+ _originalProcessUid = new Uid(Uid.nullUid());
- _originalProcessUid = new Uid(Uid.nullUid());
- _owningTransactionUid = new Uid(Uid.nullUid());
+ try
+ {
+ uncommittedState = _objectStore.read_uncommitted(_ourUid, _type);
+ }
+ catch (ObjectStoreException e)
+ {
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PACKAGE,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_6",
+ new Object[]
+ { e });
+ }
- try
- {
-
- unpackHeader(uncommittedState, _owningTransactionUid, _originalProcessUid);
+ return false; // probably
+ }
- if (txojLogger.aitLoggerI18N.isDebugEnabled())
- {
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_7",
- new Object[]{_owningTransactionUid});
- }
+ /*
+ * Get the transaction and original process information from the saved
+ * state.
+ */
- return _owningTransactionUid.notEquals(Uid.nullUid());
- }
- catch (Exception e)
- {
- if (txojLogger.aitLoggerI18N.isDebugEnabled()){
- txojLogger.aitLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_8",
- new Object[]{e});
- }
- }
+ _originalProcessUid = null;
+ _owningTransactionUid = null;
- return false;
+ try
+ {
+ Header hdr = new Header();
+
+ unpackHeader(uncommittedState, hdr);
+
+ _originalProcessUid = hdr.getProcessId();
+ _owningTransactionUid = hdr.getTxId();
+
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_7",
+ new Object[]
+ { _owningTransactionUid });
+ }
+
+ return _owningTransactionUid.notEquals(Uid.nullUid());
+ }
+ catch (Exception e)
+ {
+ if (txojLogger.aitLoggerI18N.isDebugEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ com.arjuna.ats.arjuna.logging.FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_8",
+ new Object[]
+ { e });
+ }
+ }
+
+ return false;
}
-
-private final void rollback ()
+
+ private final void rollback ()
{
- try
- {
- _objectStore.remove_uncommitted(_ourUid, _type);
- }
- catch (ObjectStoreException e)
- {
- if (txojLogger.aitLoggerI18N.isWarnEnabled()){
- txojLogger.aitLoggerI18N.warn("com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_9",
- new Object[]{_ourUid, e});
- }
- }
+ try
+ {
+ _objectStore.remove_uncommitted(_ourUid, _type);
+ }
+ catch (ObjectStoreException e)
+ {
+ if (txojLogger.aitLoggerI18N.isWarnEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .warn(
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_9",
+ new Object[]
+ { _ourUid, e });
+ }
+ }
}
-private final void commit ()
+ private final void commit ()
{
- try
- {
- _objectStore.commit_state(_ourUid, _type);
- }
- catch (ObjectStoreException e)
- {
- if (txojLogger.aitLoggerI18N.isWarnEnabled()){
- txojLogger.aitLoggerI18N.warn("com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_10",
- new Object[]{_ourUid, e});
- }
- }
+ try
+ {
+ _objectStore.commit_state(_ourUid, _type);
+ }
+ catch (ObjectStoreException e)
+ {
+ if (txojLogger.aitLoggerI18N.isWarnEnabled())
+ {
+ txojLogger.aitLoggerI18N
+ .warn(
+ "com.arjuna.ats.internal.txoj.recovery.RecoveredTransactionalObject_10",
+ new Object[]
+ { _ourUid, e });
+ }
+ }
}
-
-private Uid _ourUid;
-private Uid _owningTransactionUid;
-private Uid _originalProcessUid;
-private ObjectStore _objectStore;
-private String _type;
-private TransactionStatusConnectionManager _transactionStatusConnectionMgr;
-
+ private Uid _ourUid;
+
+ private Uid _owningTransactionUid;
+
+ private Uid _originalProcessUid;
+
+ private ObjectStore _objectStore;
+
+ private String _type;
+
+ private TransactionStatusConnectionManager _transactionStatusConnectionMgr;
+
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java 2009-11-17 12:07:01 UTC (rev 30190)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -1231,65 +1231,65 @@
currentStatus = determineStatus(this);
if (currentStatus == Status.StatusActive) // is transaction still
- // running?
+ // running?
{
- synchronized (this)
- {
- if (_synchs == null)
- {
- // Synchronizations should be stored (or at least iterated) in their natural order
- _synchs = new TreeSet();
- }
- }
+ synchronized (this)
+ {
+ if (_synchs == null)
+ {
+ // Synchronizations should be stored (or at least iterated) in their natural order
+ _synchs = new TreeSet();
+ }
+ }
- SynchronizationRecord otsSync;
+ SynchronizationRecord otsSync;
- if(sync._is_a(JTAInterposedSynchronizationHelper.id()))
- {
- otsSync = new SynchronizationRecord(sync, true);
- }
- else
- {
- otsSync = new SynchronizationRecord(sync);
- }
+ if(sync._is_a(JTAInterposedSynchronizationHelper.id()))
+ {
+ otsSync = new SynchronizationRecord(sync, true);
+ }
+ else
+ {
+ otsSync = new SynchronizationRecord(sync);
+ }
- // disallow addition of Synchronizations that would appear
- // earlier in sequence than any that has already been called
- // during the pre-commmit phase. This is required for
- // JTA 1.1 Synchronization ordering behaviour
- if(_currentRecord != null) {
- Comparable c = (Comparable)otsSync;
- if(c.compareTo(_currentRecord) != 1) {
- throw new UNKNOWN(ExceptionCodes.ADD_FAILED, CompletionStatus.COMPLETED_NO);
- }
- }
+ // disallow addition of Synchronizations that would appear
+ // earlier in sequence than any that has already been called
+ // during the pre-commmit phase. This is required for
+ // JTA 1.1 Synchronization ordering behaviour
+ if(_currentRecord != null) {
+ Comparable c = (Comparable)otsSync;
+ if(c.compareTo(_currentRecord) != 1) {
+ throw new UNKNOWN(ExceptionCodes.ADD_FAILED, CompletionStatus.COMPLETED_NO);
+ }
+ }
- if (!_synchs.add(otsSync))
- {
- otsSync = null;
- throw new UNKNOWN(ExceptionCodes.ADD_FAILED,
- CompletionStatus.COMPLETED_NO); // what else to
- // raise?
- }
+ if (!_synchs.add(otsSync))
+ {
+ otsSync = null;
+ throw new UNKNOWN(ExceptionCodes.ADD_FAILED,
+ CompletionStatus.COMPLETED_NO); // what else to
+ // raise?
+ }
}
else
{
- if (jtsLogger.logger.isDebugEnabled())
- {
- jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_synchronization - "
- + get_uid()
- + " is not active: "
- + Utility.stringStatus(currentStatus));
- }
+ if (jtsLogger.logger.isDebugEnabled())
+ {
+ jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC, com.arjuna.ats.jts.logging.FacilityCode.FAC_OTS, "ArjunaTransactionImple::register_synchronization - "
+ + get_uid()
+ + " is not active: "
+ + Utility.stringStatus(currentStatus));
+ }
- if (currentStatus == Status.StatusMarkedRollback)
- {
- throw new TRANSACTION_ROLLEDBACK(
- ExceptionCodes.MARKED_ROLLEDBACK,
- CompletionStatus.COMPLETED_NO);
- }
- else
- throw new Inactive();
+ if (currentStatus == Status.StatusMarkedRollback)
+ {
+ throw new TRANSACTION_ROLLEDBACK(
+ ExceptionCodes.MARKED_ROLLEDBACK,
+ CompletionStatus.COMPLETED_NO);
+ }
+ else
+ throw new Inactive();
}
}
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredServerTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredServerTransaction.java 2009-11-17 12:07:01 UTC (rev 30190)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredServerTransaction.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -29,9 +29,9 @@
* $Id: RecoveredServerTransaction.java 2342 2006-03-30 13:06:17Z $
*/
-
package com.arjuna.ats.internal.jts.recovery.transactions;
+import com.arjuna.ats.internal.arjuna.Header;
import com.arjuna.ats.internal.jts.Implementations;
import com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.*;
import org.omg.CosTransactions.*;
@@ -58,213 +58,303 @@
import org.omg.CORBA.TRANSIENT;
-
/**
- * Transaction type only instantiated at recovery time. This is used
- * to re-activate the state of a server transaction that did not
- * terminate correctly due to failure.
+ * Transaction type only instantiated at recovery time. This is used to
+ * re-activate the state of a server transaction that did not terminate
+ * correctly due to failure.
* <P>
+ *
* @author Dave Ingham (dave at arjuna.com)
- * @version $Id: RecoveredServerTransaction.java 2342 2006-03-30 13:06:17Z $
- *
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_1 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_1] - RecoveredServerTransaction {0} created
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_2 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_2] - RecoveredServerTransaction - activate of {0} failed!
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_4 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_4] - RecoveredServerTransaction.replayPhase2({0}) - status = {1}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_5 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_5] - RecoveredServerTransaction.replayPhase2({0}) - status after contacting parent = {1}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_6 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_6] - ServerTransaction {0} unable determine status - retry later
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_7 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_7] - RecoveredServerTransaction.replayPhase2: unexpected Status: {0}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_8 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_8] - RecoveredServerTransaction.replayPhase2: ({0}) finished
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_9 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_9] - RecoveredServerTransaction.getStatusFromParent - replay_completion status = {0}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_10 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_10] - Got TRANSIENT from ORB for tx {0} and assuming OBJECT_NOT_EXIST
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_11 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_11] - RecoveredServerTransaction.getStatusFromParent - replay_completion got object_not_exist = {0}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_12 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_12] - RecoveredServerTransaction: caught NotPrepared
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_13 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_13] - RecoveredServerTransaction: caught unexpected exception:
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_14 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_14] - RecoveredServerTransaction: {0} is invalid
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_15 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_15] - RecoveredServerTransaction:getStatusFromParent - no recovcoord or status not prepared
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_16 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_16] - "RecoveredServerTransaction.unpackHeader - txid = {0} and processUid = {1}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_17 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_17] - RecoveredServerTransaction - activate of {0} failed with {1}
+ * @version $Id: RecoveredServerTransaction.java 2342 2006-03-30 13:06:17Z $
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_1
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_1] - RecoveredServerTransaction {0}
+ * created
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_2
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_2] - RecoveredServerTransaction -
+ * activate of {0} failed!
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_4
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_4] -
+ * RecoveredServerTransaction.replayPhase2({0}) - status = {1}
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_5
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_5] -
+ * RecoveredServerTransaction.replayPhase2({0}) - status after
+ * contacting parent = {1}
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_6
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_6] - ServerTransaction {0} unable
+ * determine status - retry later
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_7
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_7] -
+ * RecoveredServerTransaction.replayPhase2: unexpected Status: {0}
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_8
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_8] -
+ * RecoveredServerTransaction.replayPhase2: ({0}) finished
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_9
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_9] -
+ * RecoveredServerTransaction.getStatusFromParent - replay_completion
+ * status = {0}
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_10
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_10] - Got TRANSIENT from ORB for tx {0}
+ * and assuming OBJECT_NOT_EXIST
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_11
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_11] -
+ * RecoveredServerTransaction.getStatusFromParent - replay_completion
+ * got object_not_exist = {0}
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_12
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_12] - RecoveredServerTransaction: caught
+ * NotPrepared
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_13
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_13] - RecoveredServerTransaction: caught
+ * unexpected exception:
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_14
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_14] - RecoveredServerTransaction: {0} is
+ * invalid
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_15
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_15] -
+ * RecoveredServerTransaction:getStatusFromParent - no recovcoord or
+ * status not prepared
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_16
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_16] -
+ * "RecoveredServerTransaction.unpackHeader - txid = {0} and processUid
+ * = {1}
+ * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_17
+ * [com.arjuna.ats.internal.jts.recovery.transactions
+ * .RecoveredServerTransaction_17] - RecoveredServerTransaction -
+ * activate of {0} failed with {1}
*/
-public class RecoveredServerTransaction extends ServerTransaction
- implements RecoveringTransaction
+public class RecoveredServerTransaction extends ServerTransaction implements
+ RecoveringTransaction
{
/**
* actionUid is the local transaction identification for the remote
- * transaction - the name of the store entry which contains the state
- * of the server transaction. The actual main transaction id is only
- * obtained when we activate the transaction.
+ * transaction - the name of the store entry which contains the state of the
+ * server transaction. The actual main transaction id is only obtained when
+ * we activate the transaction.
*/
- public RecoveredServerTransaction ( Uid actionUid )
+ public RecoveredServerTransaction(Uid actionUid)
{
this(actionUid, "");
}
/**
* actionUid is the local transaction identification for the remote
- * transaction - the name of the store entry which contains the state
- * of the server transaction. The actual main transaction id is only
- * obtained when we activate the transaction.
+ * transaction - the name of the store entry which contains the state of the
+ * server transaction. The actual main transaction id is only obtained when
+ * we activate the transaction.
*/
- public RecoveredServerTransaction ( Uid actionUid, String changedTypeName )
+ public RecoveredServerTransaction(Uid actionUid, String changedTypeName)
{
- super(actionUid);
+ super(actionUid);
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_1", new Object[]{getSavingUid()});
- }
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_1",
+ new Object[]
+ { getSavingUid() });
+ }
- // Don't bother trying to activate a transaction that isn't in
- // the store. This saves an error message.
- _recoveryStatus = RecoveryStatus.ACTIVATE_FAILED;
+ // Don't bother trying to activate a transaction that isn't in
+ // the store. This saves an error message.
+ _recoveryStatus = RecoveryStatus.ACTIVATE_FAILED;
- String effectiveTypeName = typeName();
-
- if ( changedTypeName.length() < 1) {
- _typeName = null;
- } else {
- _typeName = changedTypeName;
- effectiveTypeName = changedTypeName;
- }
+ String effectiveTypeName = typeName();
- _originalProcessUid = new Uid(Uid.nullUid());
-
- try
- {
- if ((store().currentState(getSavingUid(), effectiveTypeName) != ObjectStore.OS_UNKNOWN))
- {
- /*
- * By activating the state we get the actual transaction
- * id and process id, which are needed for recovery
- * purposes.
- */
+ if (changedTypeName.length() < 1)
+ {
+ _typeName = null;
+ }
+ else
+ {
+ _typeName = changedTypeName;
+ effectiveTypeName = changedTypeName;
+ }
- if (activate())
- _recoveryStatus = RecoveryStatus.ACTIVATED;
- else {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_2", new Object[]{getSavingUid()});
- };
- }
- }
- catch (Exception e)
- {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_2", new Object[]{getSavingUid(), e});
- }
+ _originalProcessUid = new Uid(Uid.nullUid());
- _txStatus = Status.StatusUnknown;
+ try
+ {
+ if ((store().currentState(getSavingUid(), effectiveTypeName) != ObjectStore.OS_UNKNOWN))
+ {
+ /*
+ * By activating the state we get the actual transaction id and
+ * process id, which are needed for recovery purposes.
+ */
+
+ if (activate())
+ _recoveryStatus = RecoveryStatus.ACTIVATED;
+ else
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_2",
+ new Object[]
+ { getSavingUid() });
+ }
+ ;
+ }
+ }
+ catch (Exception e)
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_2",
+ new Object[]
+ { getSavingUid(), e });
+ }
+
+ _txStatus = Status.StatusUnknown;
}
/**
- * Get the status of the transaction. If we successfully activated
- * the transaction then we return whatever the transaction reports
- * otherwise we return RolledBack as we're using presumed abort.
+ * Get the status of the transaction. If we successfully activated the
+ * transaction then we return whatever the transaction reports otherwise we
+ * return RolledBack as we're using presumed abort.
*/
public synchronized Status get_status () throws SystemException
{
- if (_txStatus != Status.StatusUnknown)
- return _txStatus;
+ if (_txStatus != Status.StatusUnknown)
+ return _txStatus;
- Status theStatus = Status.StatusUnknown;
+ Status theStatus = Status.StatusUnknown;
- if (_recoveryStatus == RecoveryStatus.ACTIVATE_FAILED)
- theStatus = Status.StatusRolledBack;
- else
- theStatus = super.get_status();
+ if (_recoveryStatus == RecoveryStatus.ACTIVATE_FAILED)
+ theStatus = Status.StatusRolledBack;
+ else
+ theStatus = super.get_status();
- return theStatus;
+ return theStatus;
}
/**
- * Allows a new Resource to be added to the transaction. Typically
- * this is used to replace a Resource that has failed and cannot
- * be recovered on it's original IOR.
+ * Allows a new Resource to be added to the transaction. Typically this is
+ * used to replace a Resource that has failed and cannot be recovered on
+ * it's original IOR.
*/
public void addResourceRecord (Uid rcUid, Resource r)
{
- Coordinator coord = null;
- AbstractRecord corbaRec = createOTSRecord(true, r, coord, rcUid);
+ Coordinator coord = null;
+ AbstractRecord corbaRec = createOTSRecord(true, r, coord, rcUid);
- addRecord(corbaRec);
+ addRecord(corbaRec);
}
-
/**
* Causes phase 2 of the commit protocol to be replayed.
*/
- public void replayPhase2()
+ public void replayPhase2 ()
{
- _recoveryStatus = RecoveryStatus.REPLAYING;
+ _recoveryStatus = RecoveryStatus.REPLAYING;
- Status theStatus = get_status();
+ Status theStatus = get_status();
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_4", new Object[]{get_uid(), Utility.stringStatus(theStatus)});
- }
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_4",
+ new Object[]
+ { get_uid(), Utility.stringStatus(theStatus) });
+ }
- if (theStatus == Status.StatusPrepared)
- {
- /*
- * We need to get the status from the our parent transaction
- * in the interposition hierarchy.
- */
- theStatus = getStatusFromParent();
-
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_5", new Object[]{get_uid(), Utility.stringStatus(theStatus)});
- }
- }
+ if (theStatus == Status.StatusPrepared)
+ {
+ /*
+ * We need to get the status from the our parent transaction in the
+ * interposition hierarchy.
+ */
+ theStatus = getStatusFromParent();
- if ( (theStatus == Status.StatusCommitting) ||
- (theStatus == Status.StatusCommitted) )
- {
- phase2Commit(_reportHeuristics);
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_5",
+ new Object[]
+ { get_uid(), Utility.stringStatus(theStatus) });
+ }
+ }
- _recoveryStatus = RecoveryStatus.REPLAYED;
+ if ((theStatus == Status.StatusCommitting)
+ || (theStatus == Status.StatusCommitted))
+ {
+ phase2Commit(_reportHeuristics);
- _txStatus = Status.StatusCommitted;
- }
- else if ( (theStatus == Status.StatusRolledBack) ||
- (theStatus == Status.StatusRollingBack) ||
- (theStatus == Status.StatusMarkedRollback) ||
- (theStatus == Status.StatusNoTransaction) )
- {
- phase2Abort(_reportHeuristics);
+ _recoveryStatus = RecoveryStatus.REPLAYED;
- _recoveryStatus = RecoveryStatus.REPLAYED;
+ _txStatus = Status.StatusCommitted;
+ }
+ else if ((theStatus == Status.StatusRolledBack)
+ || (theStatus == Status.StatusRollingBack)
+ || (theStatus == Status.StatusMarkedRollback)
+ || (theStatus == Status.StatusNoTransaction))
+ {
+ phase2Abort(_reportHeuristics);
- _txStatus = Status.StatusRolledBack;
- }
- else if ( theStatus == Status.StatusUnknown )
- {
- if (jtsLogger.loggerI18N.isInfoEnabled())
- {
- jtsLogger.loggerI18N.info("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_6", new Object[]{get_uid()});
- }
- _recoveryStatus = RecoveryStatus.REPLAY_FAILED;
- }
- else
- {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_7", new Object[]{Utility.stringStatus(theStatus)});
- _recoveryStatus = RecoveryStatus.REPLAY_FAILED;
- }
+ _recoveryStatus = RecoveryStatus.REPLAYED;
+ _txStatus = Status.StatusRolledBack;
+ }
+ else if (theStatus == Status.StatusUnknown)
+ {
+ if (jtsLogger.loggerI18N.isInfoEnabled())
+ {
+ jtsLogger.loggerI18N
+ .info(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_6",
+ new Object[]
+ { get_uid() });
+ }
+ _recoveryStatus = RecoveryStatus.REPLAY_FAILED;
+ }
+ else
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_7",
+ new Object[]
+ { Utility.stringStatus(theStatus) });
+ _recoveryStatus = RecoveryStatus.REPLAY_FAILED;
+ }
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_8", new Object[]{get_uid()});
- }
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_8",
+ new Object[]
+ { get_uid() });
+ }
}
/**
@@ -272,227 +362,277 @@
*/
public int getRecoveryStatus ()
{
- return _recoveryStatus;
+ return _recoveryStatus;
}
-/**
- * Check the status of this transaction state, i.e., that represented
- * by get_uid and not getSavingUid
- */
+ /**
+ * Check the status of this transaction state, i.e., that represented by
+ * get_uid and not getSavingUid
+ */
-public Status getOriginalStatus()
-{
- if (_recoveryStatus != RecoveryStatus.ACTIVATE_FAILED)
+ public Status getOriginalStatus ()
{
- try
- {
- /*
- * Remember to get the status on the actual global transaction
- * and not on the local branch, i.e., use get_uid and not
- * getSavingUid
- */
+ if (_recoveryStatus != RecoveryStatus.ACTIVATE_FAILED)
+ {
+ try
+ {
+ /*
+ * Remember to get the status on the actual global transaction
+ * and not on the local branch, i.e., use get_uid and not
+ * getSavingUid
+ */
- return StatusChecker.get_status(get_uid(), _originalProcessUid);
- }
- catch (Inactive ex)
- {
- // shouldn't happen!!
+ return StatusChecker.get_status(get_uid(), _originalProcessUid);
+ }
+ catch (Inactive ex)
+ {
+ // shouldn't happen!!
- return Status.StatusUnknown;
- }
+ return Status.StatusUnknown;
+ }
+ }
+ else
+ {
+ // if it can't be activated, we cant get the process uid
+ return Status.StatusUnknown;
+ }
+
}
- else
+
+ private Status getStatusFromParent ()
{
- // if it can't be activated, we cant get the process uid
- return Status.StatusUnknown;
- }
+ org.omg.CosTransactions.Status theStatus = org.omg.CosTransactions.Status.StatusUnknown;
-}
+ int not_exist_count; // This variable is applied with Orbix
+ if ((super._recoveryCoordinator != null)
+ && (get_status() == org.omg.CosTransactions.Status.StatusPrepared))
+ {
+ ServerControl sc = new ServerControl((ServerTransaction) this);
+ ServerRecoveryTopLevelAction tla = new ServerRecoveryTopLevelAction(
+ sc);
- private Status getStatusFromParent ()
- {
- org.omg.CosTransactions.Status theStatus = org.omg.CosTransactions.Status.StatusUnknown;
+ if (tla.valid())
+ {
+ try
+ {
+ theStatus = super._recoveryCoordinator
+ .replay_completion(tla.getReference());
- int not_exist_count; //This variable is applied with Orbix
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_9",
+ new Object[]
+ { Utility.stringStatus(theStatus) });
+ }
+ }
- if ((super._recoveryCoordinator != null) && (get_status() == org.omg.CosTransactions.Status.StatusPrepared))
- {
- ServerControl sc = new ServerControl((ServerTransaction) this);
- ServerRecoveryTopLevelAction tla = new ServerRecoveryTopLevelAction(sc);
+ catch (TRANSIENT ex_trans)
+ {
+ // orbix seems to count unreachable as transient, but we no
+ // longer support orbix
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_10",
+ new Object[]
+ { get_uid() });
+ theStatus = org.omg.CosTransactions.Status.StatusRolledBack;
+ }
+ // What here what should be done for Orbix2000
+ catch (OBJECT_NOT_EXIST ex)
+ {
+ // i believe this state should be notran - ots explicitly
+ // objnotexist is
+ // rollback
- if (tla.valid())
- {
- try
- {
- theStatus = super._recoveryCoordinator.replay_completion(tla.getReference());
-
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_9", new Object[]{Utility.stringStatus(theStatus)});
- }
- }
+ theStatus = org.omg.CosTransactions.Status.StatusRolledBack;
- catch (TRANSIENT ex_trans)
- {
- // orbix seems to count unreachable as transient, but we no longer support orbix
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_10", new Object[] {get_uid()});
- theStatus = org.omg.CosTransactions.Status.StatusRolledBack;
- }
- // What here what should be done for Orbix2000
- catch (OBJECT_NOT_EXIST ex)
- {
- // i believe this state should be notran - ots explicitly objnotexist is
- // rollback
+ // theStatus =
+ // org.omg.CosTransactions.Status.StatusNoTransaction;
- theStatus = org.omg.CosTransactions.Status.StatusRolledBack;
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_11",
+ new Object[]
+ { Utility.stringStatus(theStatus) });
+ }
+ }
+ catch (NotPrepared ex1)
+ {
+ jtsLogger.loggerI18N
+ .warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_12");
+ theStatus = org.omg.CosTransactions.Status.StatusActive;
+ }
+ catch (Exception e)
+ {
+ // Unknown error, so better to do nothing at this stage.
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_13",
+ e);
+ }
+ }
+ else
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_14",
+ new Object[]
+ { get_uid() });
+ }
+ ;
- // theStatus = org.omg.CosTransactions.Status.StatusNoTransaction;
+ // Make sure we "delete" these objects when we are finished
+ // with them or there will be a memory leak. If they are deleted
+ // "early", and the root coordinator needs them then it will find
+ // them unavailable, and will have to retry recovery later.
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_11", new Object[]{Utility.stringStatus(theStatus)});
- }
- }
- catch (NotPrepared ex1)
- {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_12");
- theStatus = org.omg.CosTransactions.Status.StatusActive;
- }
- catch (Exception e)
- {
- // Unknown error, so better to do nothing at this stage.
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_13", e);
- }
- }
- else {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_14", new Object[]{get_uid()});
- };
+ sc = null;
+ tla = null;
+ }
+ else
+ {
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_15");
+ }
+ }
- // Make sure we "delete" these objects when we are finished
- // with them or there will be a memory leak. If they are deleted
- // "early", and the root coordinator needs them then it will find
- // them unavailable, and will have to retry recovery later.
-
- sc = null;
- tla = null;
- }
- else
- {
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_15");
- }
- }
-
- return theStatus;
+ return theStatus;
}
public boolean allCompleted ()
{
- // return (boolean) (_recoveryStatus == RecoveryStatus.REPLAYED);
+ // return (boolean) (_recoveryStatus == RecoveryStatus.REPLAYED);
- return false;
+ return false;
}
- public String type()
+ public String type ()
{
- if (_typeName == null) {
- return super.type();
- } else {
- return _typeName;
- }
+ if (_typeName == null)
+ {
+ return super.type();
+ }
+ else
+ {
+ return _typeName;
+ }
}
- public void removeOldStoreEntry()
+ public void removeOldStoreEntry ()
{
- try
- {
- store().remove_committed(getSavingUid(), super.type());
- }
- catch (ObjectStoreException ex)
- {
- jtsLogger.loggerI18N.warn("RecoveredServerTransaction.removeOldStoreEntry ", ex);
- }
+ try
+ {
+ store().remove_committed(getSavingUid(), super.type());
+ }
+ catch (ObjectStoreException ex)
+ {
+ jtsLogger.loggerI18N.warn(
+ "RecoveredServerTransaction.removeOldStoreEntry ", ex);
+ }
}
-
- public boolean assumeComplete()
+
+ public boolean assumeComplete ()
{
- _typeName = AssumedCompleteServerTransaction.typeName();
- return true;
+ _typeName = AssumedCompleteServerTransaction.typeName();
+ return true;
}
+
/**
* Override StateManager packHeader so it gets the original processUid, not
* this process's
- *
+ *
* @since JTS 2.1.
*/
-protected void packHeader (OutputObjectState os, Uid txId,
- Uid processUid) throws IOException
+ protected void packHeader (OutputObjectState os, Header hdr)
+ throws IOException
{
- /*
- * If there is a transaction present than pack the process Uid of
- * this JVM and the tx id. Otherwise pack a null Uid.
- */
-
- super.packHeader(os, get_uid(), _originalProcessUid);
+ /*
+ * If there is a transaction present than pack the process Uid of this
+ * JVM and the tx id. Otherwise pack a null Uid.
+ */
+
+ super.packHeader(os, new Header(get_uid(), _originalProcessUid));
}
/**
* Override StateManager's unpackHeader to save the processUid of the
* original process
- *
+ *
* @since JTS 2.1.
*/
-protected void unpackHeader (InputObjectState os, Uid txId,
- Uid processUid) throws IOException
+ protected void unpackHeader (InputObjectState os, Header hdr)
+ throws IOException
+ {
+ super.unpackHeader(os, hdr);
+
+ super.objectUid = hdr.getTxId();
+ _originalProcessUid = hdr.getProcessId();
+
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_16",
+ new Object[]
+ { get_uid(), _originalProcessUid });
+ }
+ }
+
+ public boolean save_state (OutputObjectState objectState, int ot)
{
- _originalProcessUid = new Uid(Uid.nullUid());
- super.unpackHeader(os, super.objectUid, _originalProcessUid);
+ // do the other stuff
+ boolean result = super.save_state(objectState, ot);
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredServerTransaction_16", new Object[]{get_uid(), _originalProcessUid});
- }
+ // iff assumed complete, include the time (this should happen only once)
+ if (_typeName != null && result)
+ {
+ Date lastActiveTime = new Date();
+ try
+ {
+ objectState.packLong(lastActiveTime.getTime());
+ }
+ catch (java.io.IOException ex)
+ {
+ }
+ }
+ return result;
}
-public boolean save_state (OutputObjectState objectState, int ot)
-{
- // do the other stuff
- boolean result = super.save_state(objectState,ot);
-
- // iff assumed complete, include the time (this should happen only once)
- if (_typeName != null && result) {
- Date lastActiveTime = new Date();
- try {
- objectState.packLong(lastActiveTime.getTime());
- } catch (java.io.IOException ex) {
- }
+ /** do not admit to being inactive */
+ public Date getLastActiveTime ()
+ {
+ return null;
}
- return result;
-}
-/** do not admit to being inactive */
-public Date getLastActiveTime()
-{
- return null;
-}
-
protected Uid _originalProcessUid;
private String _typeName;
- private boolean _reportHeuristics = false;
- private int _recoveryStatus = RecoveryStatus.NEW;
+ private boolean _reportHeuristics = false;
+
+ private int _recoveryStatus = RecoveryStatus.NEW;
+
private org.omg.CosTransactions.Status _txStatus;
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredTransaction.java 2009-11-17 12:07:01 UTC (rev 30190)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/RecoveredTransaction.java 2009-11-17 13:51:00 UTC (rev 30191)
@@ -29,11 +29,11 @@
* $Id: RecoveredTransaction.java 2342 2006-03-30 13:06:17Z $
*/
-
package com.arjuna.ats.internal.jts.recovery.transactions;
import com.arjuna.ats.jts.utils.Utility;
+import com.arjuna.ats.internal.arjuna.Header;
import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
import com.arjuna.ats.internal.jts.recovery.contact.StatusChecker;
import com.arjuna.ats.arjuna.exceptions.*;
@@ -53,135 +53,177 @@
import org.omg.CORBA.SystemException;
/**
- * Transaction type only instantiated at recovery time. This is used
- * to re-activate the state of a root (non-interposed) transaction
- * that did not terminate correctly due to failure.
+ * Transaction type only instantiated at recovery time. This is used to
+ * re-activate the state of a root (non-interposed) transaction that did not
+ * terminate correctly due to failure.
* <P>
+ *
* @author Dave Ingham (dave at arjuna.com)
- * @version $Id: RecoveredTransaction.java 2342 2006-03-30 13:06:17Z $
- *
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_1 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_1] - RecoveredTransaction {0} created
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_2 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_2] - RecoveredTransaction activate of {0} failed
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_3 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_3] - RecoveredTransaction activate of {0} failed - {1}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_5 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_5] - RecoveredTransaction.replayPhase2 ({0}) - status = {1}
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_6 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_6] - RecoveredTransaction.replayPhase2 for {0} failed
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_7 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_7] - RecoveredTransaction.replayPhase2 ({0}) finished
- * @message com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_8 [com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_8] - RecoveredTransaction.removeOldStoreEntry - problem
+ * @version $Id: RecoveredTransaction.java 2342 2006-03-30 13:06:17Z $
+ * @message
+ * com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_1
+ * [com.arjuna.ats.internal.jts.recovery.transactions.
+ * RecoveredTransaction_1] - RecoveredTransaction {0} created
+ * @message
+ * com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_2
+ * [com.arjuna.ats.internal.jts.recovery.transactions.
+ * RecoveredTransaction_2] - RecoveredTransaction activate of {0}
+ * failed
+ * @message
+ * com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_3
+ * [com.arjuna.ats.internal.jts.recovery.transactions.
+ * RecoveredTransaction_3] - RecoveredTransaction activate of {0}
+ * failed - {1}
+ * @message
+ * com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_5
+ * [com.arjuna.ats.internal.jts.recovery.transactions.
+ * RecoveredTransaction_5] - RecoveredTransaction.replayPhase2 ({0}) -
+ * status = {1}
+ * @message
+ * com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_6
+ * [com.arjuna.ats.internal.jts.recovery.transactions.
+ * RecoveredTransaction_6] - RecoveredTransaction.replayPhase2 for {0}
+ * failed
+ * @message
+ * com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_7
+ * [com.arjuna.ats.internal.jts.recovery.transactions.
+ * RecoveredTransaction_7] - RecoveredTransaction.replayPhase2 ({0})
+ * finished
+ * @message
+ * com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_8
+ * [com.arjuna.ats.internal.jts.recovery.transactions.
+ * RecoveredTransaction_8] - RecoveredTransaction.removeOldStoreEntry -
+ * problem
*/
-public class RecoveredTransaction extends ArjunaTransactionImple
- implements RecoveringTransaction
+public class RecoveredTransaction extends ArjunaTransactionImple implements
+ RecoveringTransaction
{
- public RecoveredTransaction ( Uid actionUid )
+ public RecoveredTransaction(Uid actionUid)
{
- this(actionUid, "");
+ this(actionUid, "");
}
- public RecoveredTransaction ( Uid actionUid, String changedTypeName )
+ public RecoveredTransaction(Uid actionUid, String changedTypeName)
{
- super(actionUid);
+ super(actionUid);
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.CONSTRUCTORS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_1", new Object[]{get_uid()});
- }
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_1",
+ new Object[]
+ { get_uid() });
+ }
+ // Don't bother trying to activate a transaction that isn't in
+ // the store. This saves an error message.
+ _recoveryStatus = RecoveryStatus.ACTIVATE_FAILED;
- // Don't bother trying to activate a transaction that isn't in
- // the store. This saves an error message.
- _recoveryStatus = RecoveryStatus.ACTIVATE_FAILED;
+ String effectiveTypeName = typeName();
- String effectiveTypeName = typeName();
+ if (changedTypeName.length() < 1)
+ {
+ _typeName = null;
+ }
+ else
+ {
+ _typeName = changedTypeName;
+ effectiveTypeName = changedTypeName;
+ }
- if ( changedTypeName.length() < 1) {
- _typeName = null;
- } else {
- _typeName = changedTypeName;
- effectiveTypeName = changedTypeName;
- }
+ _originalProcessUid = new Uid(Uid.nullUid());
- _originalProcessUid = new Uid(Uid.nullUid());
+ try
+ {
+ if ((store().currentState(actionUid, effectiveTypeName) != ObjectStore.OS_UNKNOWN))
+ {
+ if (activate())
+ _recoveryStatus = RecoveryStatus.ACTIVATED;
+ else
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_2",
+ new Object[]
+ { actionUid });
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_3",
+ new Object[]
+ { actionUid, e }, e);
+ }
- try
- {
- if ((store().currentState(actionUid, effectiveTypeName) != ObjectStore.OS_UNKNOWN))
- {
- if (activate())
- _recoveryStatus = RecoveryStatus.ACTIVATED;
- else
- {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_2", new Object[]{actionUid});
- }
- }
- }
- catch (Exception e)
- {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_3", new Object[]{actionUid, e}, e);
- }
-
- _txStatus = Status.StatusUnknown;
+ _txStatus = Status.StatusUnknown;
}
/**
- * Get the status of the transaction. If we successfully activated
- * the transaction then we return whatever the transaction reports
- * otherwise we return RolledBack as we're using presumed abort.
+ * Get the status of the transaction. If we successfully activated the
+ * transaction then we return whatever the transaction reports otherwise we
+ * return RolledBack as we're using presumed abort.
*/
public synchronized Status get_status () throws SystemException
{
- if (_txStatus != Status.StatusUnknown)
- return _txStatus;
+ if (_txStatus != Status.StatusUnknown)
+ return _txStatus;
- Status theStatus = Status.StatusUnknown;
+ Status theStatus = Status.StatusUnknown;
- if (_recoveryStatus == RecoveryStatus.ACTIVATE_FAILED)
- theStatus = Status.StatusRolledBack;
- else
- theStatus = super.get_status();
+ if (_recoveryStatus == RecoveryStatus.ACTIVATE_FAILED)
+ theStatus = Status.StatusRolledBack;
+ else
+ theStatus = super.get_status();
- return theStatus;
+ return theStatus;
}
-/**
+ /**
*
*/
-public Status getOriginalStatus()
-{
- if (_recoveryStatus != RecoveryStatus.ACTIVATE_FAILED)
+ public Status getOriginalStatus ()
{
- try
- {
- return StatusChecker.get_status(get_uid(), _originalProcessUid);
- }
- catch (Inactive ex)
- {
- // shouldn't happen!
+ if (_recoveryStatus != RecoveryStatus.ACTIVATE_FAILED)
+ {
+ try
+ {
+ return StatusChecker.get_status(get_uid(), _originalProcessUid);
+ }
+ catch (Inactive ex)
+ {
+ // shouldn't happen!
- return Status.StatusUnknown;
- }
+ return Status.StatusUnknown;
+ }
+ }
+ else
+ {
+ // if it can't be activated, we can't get the process uid
+ return Status.StatusUnknown;
+ }
+
}
- else
- {
- // if it can't be activated, we can't get the process uid
- return Status.StatusUnknown;
- }
-}
-
/**
- * Allows a new Resource to be added to the transaction. Typically
- * this is used to replace a Resource that has failed and cannot
- * be recovered on it's original IOR.
+ * Allows a new Resource to be added to the transaction. Typically this is
+ * used to replace a Resource that has failed and cannot be recovered on
+ * it's original IOR.
*/
public void addResourceRecord (Uid rcUid, Resource r)
{
- Coordinator coord = null;
- AbstractRecord corbaRec = createOTSRecord(true, r, coord, rcUid);
+ Coordinator coord = null;
+ AbstractRecord corbaRec = createOTSRecord(true, r, coord, rcUid);
- addRecord(corbaRec);
+ addRecord(corbaRec);
}
/**
@@ -190,49 +232,63 @@
public void replayPhase2 ()
{
- _recoveryStatus = RecoveryStatus.REPLAYING;
+ _recoveryStatus = RecoveryStatus.REPLAYING;
- Status theStatus = get_status();
+ Status theStatus = get_status();
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_5", new Object[]{get_uid(), Utility.stringStatus(theStatus)});
- }
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_5",
+ new Object[]
+ { get_uid(), Utility.stringStatus(theStatus) });
+ }
- if ( (theStatus == Status.StatusPrepared) ||
- (theStatus == Status.StatusCommitting) ||
- (theStatus == Status.StatusCommitted) )
- {
- phase2Commit(_reportHeuristics);
+ if ((theStatus == Status.StatusPrepared)
+ || (theStatus == Status.StatusCommitting)
+ || (theStatus == Status.StatusCommitted))
+ {
+ phase2Commit(_reportHeuristics);
- _recoveryStatus = RecoveryStatus.REPLAYED;
+ _recoveryStatus = RecoveryStatus.REPLAYED;
- _txStatus = Status.StatusCommitted;
- }
- else if ( (theStatus == Status.StatusRolledBack) ||
- (theStatus == Status.StatusRollingBack) ||
- (theStatus == Status.StatusMarkedRollback) )
- {
- phase2Abort(_reportHeuristics);
+ _txStatus = Status.StatusCommitted;
+ }
+ else if ((theStatus == Status.StatusRolledBack)
+ || (theStatus == Status.StatusRollingBack)
+ || (theStatus == Status.StatusMarkedRollback))
+ {
+ phase2Abort(_reportHeuristics);
- _recoveryStatus = RecoveryStatus.REPLAYED;
+ _recoveryStatus = RecoveryStatus.REPLAYED;
- _txStatus = Status.StatusRolledBack;
- }
- else
- {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_6", new Object[]{Utility.stringStatus(theStatus)});
- _recoveryStatus = RecoveryStatus.REPLAY_FAILED;
- }
+ _txStatus = Status.StatusRolledBack;
+ }
+ else
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_6",
+ new Object[]
+ { Utility.stringStatus(theStatus) });
+ _recoveryStatus = RecoveryStatus.REPLAY_FAILED;
+ }
- if (jtsLogger.loggerI18N.isDebugEnabled())
- {
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_5", new Object[]{get_uid()});
- }
+ if (jtsLogger.loggerI18N.isDebugEnabled())
+ {
+ jtsLogger.loggerI18N
+ .debug(
+ DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_5",
+ new Object[]
+ { get_uid() });
+ }
}
/**
@@ -240,121 +296,140 @@
*/
public int getRecoveryStatus ()
{
- return _recoveryStatus;
+ return _recoveryStatus;
}
// hmmm, isn't this a memory leak, since we'll never purge the cache?!
/*
- * What we need is to have allCompleted return REPLAYED as it should,
- * but for entries to remain in the cache for a period of time to
- * catch any timing issues, such as when an upcall recovery passes a
- * downcall recovery.
+ * What we need is to have allCompleted return REPLAYED as it should, but
+ * for entries to remain in the cache for a period of time to catch any
+ * timing issues, such as when an upcall recovery passes a downcall
+ * recovery.
*/
public boolean allCompleted ()
{
- synchronized (this)
- {
- if ((super.preparedList != null) && (super.preparedList.size() > 0))
- return false;
+ synchronized (this)
+ {
+ if ((super.preparedList != null) && (super.preparedList.size() > 0))
+ return false;
- if ((super.failedList != null) && (super.failedList.size() > 0))
- return false;
+ if ((super.failedList != null) && (super.failedList.size() > 0))
+ return false;
- if ((super.pendingList != null) && (super.pendingList.size() > 0))
- return false;
+ if ((super.pendingList != null) && (super.pendingList.size() > 0))
+ return false;
- if ((super.heuristicList != null) && (super.heuristicList.size() > 0))
- return false;
+ if ((super.heuristicList != null)
+ && (super.heuristicList.size() > 0))
+ return false;
- return true;
- }
+ return true;
+ }
}
- public String type()
+ public String type ()
{
- if (_typeName == null) {
- return super.type();
- } else {
- return _typeName;
- }
+ if (_typeName == null)
+ {
+ return super.type();
+ }
+ else
+ {
+ return _typeName;
+ }
}
- public void removeOldStoreEntry()
+ public void removeOldStoreEntry ()
{
- try {
- store().remove_committed(get_uid(), super.type());
- } catch (ObjectStoreException ex) {
- jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_8", ex);
- }
+ try
+ {
+ store().remove_committed(get_uid(), super.type());
+ }
+ catch (ObjectStoreException ex)
+ {
+ jtsLogger.loggerI18N
+ .warn(
+ "com.arjuna.ats.internal.jts.recovery.transactions.RecoveredTransaction_8",
+ ex);
+ }
}
- public boolean assumeComplete()
+ public boolean assumeComplete ()
{
- _typeName = AssumedCompleteTransaction.typeName();
+ _typeName = AssumedCompleteTransaction.typeName();
- return true;
+ return true;
}
/**
* Override StateManager packHeader so it gets the original processUid, not
* this process's
- *
+ *
* @since JTS 2.1.
*/
-protected void packHeader (OutputObjectState os, Uid txId,
- Uid processUid) throws IOException
+ protected void packHeader (OutputObjectState os, Header hdr)
+ throws IOException
{
- /*
- * If there is a transaction present than pack the process Uid of
- * this JVM and the tx id. Otherwise pack a null Uid.
- */
+ /*
+ * If there is a transaction present than pack the process Uid of this
+ * JVM and the tx id. Otherwise pack a null Uid.
+ */
- super.packHeader(os, txId, _originalProcessUid);
+ super.packHeader(os, new Header(hdr.getTxId(), _originalProcessUid));
}
/**
* Override StateManager's unpackHeader to save the processUid of the
* original process
- *
+ *
* @since JTS 2.1.
*/
-protected void unpackHeader (InputObjectState os, Uid txId,
- Uid processUid) throws IOException
+ protected void unpackHeader (InputObjectState os, Header hdr)
+ throws IOException
{
- _originalProcessUid = new Uid(Uid.nullUid());
- super.unpackHeader(os, txId, _originalProcessUid);
+ super.unpackHeader(os, hdr);
+
+ _originalProcessUid = hdr.getProcessId();
}
-public boolean save_state (OutputObjectState objectState, int ot)
-{
- // do the other stuff
- boolean result = super.save_state(objectState,ot);
+ public boolean save_state (OutputObjectState objectState, int ot)
+ {
+ // do the other stuff
+ boolean result = super.save_state(objectState, ot);
- // iff assumed complete, include the time (this should happen only once)
- if (_typeName != null && result) {
- Date lastActiveTime = new Date();
- try {
- objectState.packLong(lastActiveTime.getTime());
- } catch (java.io.IOException ex) {
- }
+ // iff assumed complete, include the time (this should happen only once)
+ if (_typeName != null && result)
+ {
+ Date lastActiveTime = new Date();
+ try
+ {
+ objectState.packLong(lastActiveTime.getTime());
+ }
+ catch (java.io.IOException ex)
+ {
+ }
+ }
+ return result;
}
- return result;
-}
-/** do not admit to being inactive */
-public Date getLastActiveTime()
-{
- return null;
-}
+ /** do not admit to being inactive */
+ public Date getLastActiveTime ()
+ {
+ return null;
+ }
private String _typeName;
- private boolean _reportHeuristics = false;
- private int _recoveryStatus = RecoveryStatus.NEW;
+
+ private boolean _reportHeuristics = false;
+
+ private int _recoveryStatus = RecoveryStatus.NEW;
+
protected Uid _originalProcessUid;
+
private org.omg.CosTransactions.Status _txStatus;
}
More information about the jboss-svn-commits
mailing list