[jboss-svn-commits] JBL Code SVN: r23496 - in labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts: xts/recovery and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 17 09:03:49 EDT 2008
Author: adinn
Date: 2008-10-17 09:03:49 -0400 (Fri, 17 Oct 2008)
New Revision: 23496
Added:
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ACCoordinatorRecoveryModule.java
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/Implementations.java
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ParticipantRecordSetup.java
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverACCoordinator.java
Removed:
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ACCoordinatorRecoveryModule.java
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/Implementations.java
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ParticipantRecordSetup.java
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/RecoverACCoordinator.java
Modified:
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java
Log:
reorganized AT recovery classes into AT-specific package so they don't class with BA recovery classes
Modified: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java 2008-10-17 12:09:36 UTC (rev 23495)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -21,7 +21,7 @@
package org.jboss.jbossts;
import org.jboss.logging.Logger;
-import org.jboss.jbossts.xts.recovery.ACCoordinatorRecoveryModule;
+import org.jboss.jbossts.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule;
import org.jboss.jbossts.xts.recovery.participant.at.ATParticipantRecoveryModule;
//import com.arjuna.mw.wst.deploy.WSTXInitialisation;
@@ -74,11 +74,7 @@
//import com.arjuna.wst.messaging.*;
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
-import javax.management.ObjectName;
-import javax.management.AttributeNotFoundException;
-import javax.management.JMException;
import javax.management.MBeanServer;
-import java.util.Set;
import java.net.InetAddress;
//import com.arjuna.ats.arjuna.recovery.RecoveryModule;
Deleted: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ACCoordinatorRecoveryModule.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ACCoordinatorRecoveryModule.java 2008-10-17 12:09:36 UTC (rev 23495)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ACCoordinatorRecoveryModule.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -1,352 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, 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) 2007,
- * @author Red Hat Middleware LLC.
- */
-package org.jboss.jbossts.xts.recovery;
-
-import org.jboss.jbossts.xts.logging.XTSLogger;
-import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager;
-
-import com.arjuna.ats.arjuna.recovery.RecoveryModule;
-import com.arjuna.ats.arjuna.recovery.TransactionStatusConnectionManager;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
-import com.arjuna.ats.arjuna.coordinator.TxControl;
-import com.arjuna.ats.arjuna.coordinator.ActionStatus;
-import com.arjuna.ats.arjuna.state.InputObjectState;
-import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.objectstore.ObjectStore;
-import com.arjuna.common.util.logging.DebugLevel;
-import com.arjuna.common.util.logging.VisibilityLevel;
-
-import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ACCoordinator;
-import com.arjuna.webservices.base.processors.ReactivatedObjectProcessor;
-
-import java.util.Vector;
-import java.util.Enumeration;
-
-/**
- * This class is a plug-in module for the recovery manager.
- * It is responsible for recovering failed XTS (ACCoordinator) transactions.
- *
- * Responsible for recovering instances of XTS Transaction Coordinators
- * (com.arjuna.mwlabs.wscf.model.as.coordinator.arjunacore.ACCoordinator)
- * Modelled on com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule
- * TODO: refactor this and AtomicActionRecoveryModule to remove duplication?
- *
- * $Id$
- *
- * @message com.arjuna.ats.internal.arjuna.recovery.ACCoordinatorRecoveryModule_1 [org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_1] - RecoveryManagerStatusModule: Object store exception: {0}
- * @message org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_2 [org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_2] - failed to recover Transaction {0} {1}
- * @message org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_3 [org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_3] - failed to access transaction store {0} {1}
- */
-public class ACCoordinatorRecoveryModule implements RecoveryModule
-{
- public ACCoordinatorRecoveryModule()
- {
- if (XTSLogger.arjLogger.isDebugEnabled())
- {
- XTSLogger.arjLogger.debug
- ( DebugLevel.CONSTRUCTORS,
- VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "ACCoordinatorRecoveryModule created - default" );
- }
-
- if (_transactionStore == null)
- {
- _transactionStore = TxControl.getStore() ;
- }
-
- _transactionStatusConnectionMgr = new TransactionStatusConnectionManager() ;
- }
-
- /**
- * called by the service startup code before the recovery module is added to the recovery managers
- * module list
- */
- public void install()
- {
- Implementations.install();
- }
-
- /**
- * module list in order to allow the implementations list to be purged of this module's implementations
- */
- public void uninstall()
- {
- Implementations.uninstall();
- }
-
- /**
- * This is called periodically by the RecoveryManager
- */
- public void periodicWorkFirstPass()
- {
- // Transaction type
- boolean ACCoordinators = false ;
-
- // uids per transaction type
- InputObjectState acc_uids = new InputObjectState() ;
-
- try
- {
- if (XTSLogger.arjLogger.isDebugEnabled())
- {
- XTSLogger.arjLogger.debug( "StatusModule: first pass " );
- }
-
- ACCoordinators = _transactionStore.allObjUids( _transactionType, acc_uids );
-
- }
- catch ( ObjectStoreException ex )
- {
- if (XTSLogger.arjLoggerI18N.isWarnEnabled())
- {
- XTSLogger.arjLoggerI18N.warn("org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_1",
- new Object[]{ex});
- }
- }
-
- if ( ACCoordinators )
- {
- _transactionUidVector = processTransactions( acc_uids ) ;
- }
- }
-
- public void periodicWorkSecondPass()
- {
- if (XTSLogger.arjLogger.isDebugEnabled())
- {
- XTSLogger.arjLogger.debug( "ACCoordinatorRecoveryModule: Second pass " );
- }
-
- if (_transactionUidVector != null) {
- processTransactionsStatus() ;
- }
-
- // ok notify the coordinator processor that recovery processing has completed
-
- }
-
- protected ACCoordinatorRecoveryModule (String type)
- {
- if (XTSLogger.arjLogger.isDebugEnabled())
- {
- XTSLogger.arjLogger.debug
- ( DebugLevel.CONSTRUCTORS,
- VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "ACCoordinatorRecoveryModule created " + type );
- }
-
- if (_transactionStore == null)
- {
- _transactionStore = TxControl.getStore() ;
- }
-
- _transactionStatusConnectionMgr = new TransactionStatusConnectionManager() ;
- _transactionType = type;
-
- }
-
- private void doRecoverTransaction( Uid recoverUid )
- {
- boolean commitThisTransaction = true ;
-
- // Retrieve the transaction status from its original process.
- // n.b. for a non-active XTS TX this status wil l always be committed even
- // if it aborted or had a heuristic outcome. in that case we need to use
- // the logged action status which can only be retrieved after activation
-
- int theStatus = _transactionStatusConnectionMgr.getTransactionStatus( _transactionType, recoverUid ) ;
-
- boolean inFlight = isTransactionInMidFlight( theStatus ) ;
-
- String Status = ActionStatus.stringForm( theStatus ) ;
-
- if (XTSLogger.arjLogger.isDebugEnabled())
- {
- XTSLogger.arjLogger.debug
- ( DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "transaction type is "+ _transactionType + " uid is " +
- recoverUid.toString() + "\n ActionStatus is " + Status +
- " in flight is " + inFlight ) ;
- }
-
- if ( ! inFlight )
- {
- try
- {
- XTSLogger.arjLogger.debug( DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY, "jjh doing revovery here for "+recoverUid);
- // TODO jjh
- RecoverACCoordinator rcvACCoordinator =
- new RecoverACCoordinator(recoverUid);
-// RecoverAtomicAction rcvAtomicAction =
-// new RecoverAtomicAction( recoverUid, theStatus ) ;
-
-// rcvAtomicAction.replayPhase2() ;
- rcvACCoordinator.replayPhase2();
- }
- catch ( Exception ex )
- {
- if (XTSLogger.arjLoggerI18N.isWarnEnabled())
- {
- XTSLogger.arjLoggerI18N.warn("org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_2",
- new Object[]{recoverUid.toString(), ex});
- }
- }
- }
- }
-
- private boolean isTransactionInMidFlight( int status )
- {
- boolean inFlight = false ;
-
- switch ( status )
- {
- // these states can only come from a process that is still alive
- case ActionStatus.RUNNING :
- case ActionStatus.ABORT_ONLY :
- case ActionStatus.PREPARING :
- case ActionStatus.COMMITTING :
- case ActionStatus.ABORTING :
- case ActionStatus.PREPARED :
- inFlight = true ;
- break ;
-
- // the transaction is apparently still there, but has completed its
- // phase2. should be safe to redo it.
- case ActionStatus.COMMITTED :
- case ActionStatus.H_COMMIT :
- case ActionStatus.H_MIXED :
- case ActionStatus.H_HAZARD :
- case ActionStatus.ABORTED :
- case ActionStatus.H_ROLLBACK :
- inFlight = false ;
- break ;
-
- // this shouldn't happen
- case ActionStatus.INVALID :
- default:
- inFlight = false ;
- }
-
- return inFlight ;
- }
-
- private Vector processTransactions( InputObjectState uids )
- {
- Vector uidVector = new Vector() ;
-
- if (XTSLogger.arjLogger.isDebugEnabled())
- {
- XTSLogger.arjLogger.debug( DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "processing " + _transactionType
- + " transactions" ) ;
- }
-
- Uid theUid = new Uid( Uid.nullUid() );
-
- boolean moreUids = true ;
-
- while (moreUids)
- {
- try
- {
- theUid.unpack( uids ) ;
-
- if (theUid.equals( Uid.nullUid() ))
- {
- moreUids = false;
- }
- else
- {
- Uid newUid = new Uid( theUid ) ;
-
- if (XTSLogger.arjLogger.isDebugEnabled())
- {
- XTSLogger.arjLogger.debug
- ( DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "found transaction "+ newUid ) ;
- }
-
- uidVector.addElement( newUid ) ;
- }
- }
- catch ( Exception ex )
- {
- moreUids = false;
- }
- }
- return uidVector ;
- }
-
- private void processTransactionsStatus()
- {
- // Process the Vector of transaction Uids
- Enumeration transactionUidEnum = _transactionUidVector.elements() ;
-
- while ( transactionUidEnum.hasMoreElements() )
- {
- Uid currentUid = (Uid) transactionUidEnum.nextElement();
-
- try
- {
- if ( _transactionStore.currentState( currentUid, _transactionType ) != ObjectStore.OS_UNKNOWN )
- {
- doRecoverTransaction( currentUid ) ;
- }
- }
- catch ( ObjectStoreException ex )
- {
- if (XTSLogger.arjLogger.isWarnEnabled())
- {
- XTSLogger.arjLoggerI18N.warn("org.jboss.transactions.xts.recovery.ACCoordinatorRecoveryModule_3",
- new Object[]{currentUid.toString(), ex});
- }
- }
- }
-
- XTSATRecoveryManager.getRecoveryManager().setCoordinatorRecoveryStarted();
- }
-
- // 'type' within the Object Store for ACCoordinator.
- private String _transactionType = new ACCoordinator().type() ;
-
- // Array of transactions found in the object store of the
- // ACCoordinator type.
- private Vector _transactionUidVector = null ;
-
- // Reference to the Object Store.
- private static ObjectStore _transactionStore = null ;
-
- // This object manages the interface to all TransactionStatusManagers
- // processes(JVMs) on this system/node.
- private TransactionStatusConnectionManager _transactionStatusConnectionMgr ;
-
-}
-
Deleted: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/Implementations.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/Implementations.java 2008-10-17 12:09:36 UTC (rev 23495)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/Implementations.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -1,57 +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.
- */
-
-package org.jboss.jbossts.xts.recovery;
-
-import com.arjuna.ats.arjuna.gandiva.inventory.Inventory;
-
-/**
- * Module specific class that is responsible for adding any implementations
- * to the inventory.
- *
- * @author Mark Little (mark at arjuna.com)
- * @version $Id: Implementations.java 2342 2006-03-30 13:06:17Z $
- * @since JTS 1.0.
- */
-public class Implementations {
-
- static ParticipantRecordSetup _inventoryItem = null;
-
- public static synchronized void install ()
- {
- if (_inventoryItem == null) {
- _inventoryItem = new ParticipantRecordSetup();
- // WS-AT Participant records.
- Inventory.inventory().addToList(_inventoryItem);
- }
- }
-
- public static synchronized void uninstall()
- {
- if (_inventoryItem != null) {
- Inventory.inventory().removeFromList(_inventoryItem.className());
- }
- }
-
- private Implementations ()
- {
- }
-}
Deleted: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ParticipantRecordSetup.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ParticipantRecordSetup.java 2008-10-17 12:09:36 UTC (rev 23495)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ParticipantRecordSetup.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -1,75 +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.
- */
-package org.jboss.jbossts.xts.recovery;
-
-import com.arjuna.ats.arjuna.gandiva.inventory.InventoryElement;
-import com.arjuna.ats.arjuna.gandiva.ClassName;
-import com.arjuna.ats.arjuna.gandiva.ObjectName;
-import com.arjuna.ats.arjuna.coordinator.RecordType;
-
-import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord;
-
-/**
- * Created by IntelliJ IDEA.
- * User: jhalli
- * Date: Aug 20, 2007
- * Time: 3:18:23 PM
- * To change this template use File | Settings | File Templates.
- */
-public class ParticipantRecordSetup implements InventoryElement {
-
- public synchronized Object createVoid ()
- {
- return ParticipantRecord.create();
- }
-
- public synchronized Object createClassName (ClassName className)
- {
- return null;
- }
-
- public synchronized Object createObjectName (ObjectName objectName)
- {
- return null;
- }
-
- public synchronized Object createResources (Object[] resources)
- {
- return null;
- }
-
- public synchronized Object createClassNameResources (ClassName className, Object[] resources)
- {
- return null;
- }
-
- public synchronized Object createObjectNameResources (ObjectName objectName, Object[] resources)
- {
- return null;
- }
-
- public ClassName className ()
- {
- return RecordType.typeToClassName(RecordType.USER_DEF_FIRST0);
- //ClassName("WSATParticipantRecord"); // TODO remove dupl with ParticipantRecord
- }
-
-}
Deleted: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/RecoverACCoordinator.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/RecoverACCoordinator.java 2008-10-17 12:09:36 UTC (rev 23495)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/RecoverACCoordinator.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -1,105 +0,0 @@
-package org.jboss.jbossts.xts.recovery;
-
-import org.jboss.jbossts.xts.logging.XTSLogger;
-
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
-import com.arjuna.ats.arjuna.coordinator.ActionStatus;
-
-import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ACCoordinator;
-import com.arjuna.common.util.logging.DebugLevel;
-import com.arjuna.common.util.logging.VisibilityLevel;
-
-/**
- * This class is a plug-in module for the recovery manager.
- * It is responsible for recovering failed ACCoordinator transactions.
- *
- * @message org.jboss.transactions.xts.recovery.RecoverACCoordinator_1 [org.jboss.transactions.xts.recovery.RecoverACCoordinator_1] - RecoverACCoordinator.replayPhase2 recovering {0} ActionStatus is {1}
- * @message org.jboss.transactions.xts.recovery.RecoverACCoordinator_2 [org.jboss.transactions.xts.recovery.RecoverACCoordinator_2] - RecoverACCoordinator.replayPhase2: Unexpected status: {0}
- * @message org.jboss.transactions.xts.recovery.RecoverACCoordinator_3 [org.jboss.transactions.xts.recovery.RecoverACCoordinator_3] - RecoverACCoordinator.replayPhase2( {0} ) finished
- * @message org.jboss.transactions.xts.recovery.RecoverACCoordinator_4 [org.jboss.transactions.xts.recovery.RecoverACCoordinator_4] - RecoverACCoordinator.replayPhase2 transaction {0} not activated, unable to replay phase 2 commit
-*/
-public class RecoverACCoordinator extends ACCoordinator {
-
- // TODO: refactor RecoverAtomicAction so that this can subclass it to remove dupl?
-
- /**
- * Re-creates/activates an AtomicAction for the specified
- * transaction Uid.
- */
- public RecoverACCoordinator ( Uid rcvUid )
- {
- super( rcvUid ) ;
- _activated = activate() ;
- }
-
- /**
- * Replays phase 2 of the commit protocol.
- */
- public void replayPhase2()
- {
- final int status = status();
-
- if (XTSLogger.arjLoggerI18N.debugAllowed())
- {
- XTSLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "org.jboss.transactions.xts.recovery.RecoverACCoordinator_1",
- new Object[]{get_uid(), ActionStatus.stringForm(status)});
- }
-
- if ( _activated )
- {
- // we only need to rerun phase2 if the action status is PREPARED, which happens
- // when we crash before or during commit, or COMMITTING, which happens when we get
- // a comms timeout from one of the participants after sending it a COMMIT message.
- // in the former case all participant records will be listed in the prepared list.
- // in the latter case the failed participant record(s) will have been reinstated in the
- // prepared list and the participant stub engine reactivated, where necessary,
- // under the call to activate() when this coordinator was created.
-
- // we can also arrive here when the action status is ABORTING. This happens when we
- // get a comms timeout from one of the participants after sending it a PREPARE message
- // or if we get a comms timeout from one of the participants after sending it a ROLLBACK
- // message. In either case the failed participant record(s) will be listed in the heuristic
- // list. Since this list is ignored completely by phase2Abort there is no point doing
- // anything here. there are also cases where actionStatus is a heuristic outcome. Once
- // again it is pointless calling phase2Abort since the prepared list is empty.
-
- if ((status == ActionStatus.PREPARED) ||
- (status == ActionStatus.COMMITTING) ||
- (status == ActionStatus.COMMITTED) ||
- (status == ActionStatus.H_COMMIT) ||
- (status == ActionStatus.H_MIXED) ||
- (status == ActionStatus.H_HAZARD))
- {
- super.phase2Commit( _reportHeuristics ) ;
- } else if ((status == ActionStatus.ABORTED) ||
- (status == ActionStatus.H_ROLLBACK) ||
- (status == ActionStatus.ABORTING) ||
- (status == ActionStatus.ABORT_ONLY))
- {
- super.phase2Abort( _reportHeuristics ) ;
- }
-
- if (XTSLogger.arjLoggerI18N.debugAllowed())
- {
- XTSLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
- "org.jboss.transactions.xts.recovery.RecoverACCoordinator_3",
- new Object[]{get_uid()});
- }
- }
- else
- {
- XTSLogger.arjLoggerI18N.warn("org.jboss.transactions.xts.recovery.RecoverACCoordinator_4", new Object[]{get_uid()});
- }
- }
-
- // Flag to indicate that this transaction has been re-activated
- // successfully.
- private boolean _activated = false ;
-
- // whether heuristic reporting on phase 2 commit is enabled.
- private boolean _reportHeuristics = true ;
-}
Copied: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ACCoordinatorRecoveryModule.java (from rev 23495, labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ACCoordinatorRecoveryModule.java)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ACCoordinatorRecoveryModule.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ACCoordinatorRecoveryModule.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -0,0 +1,351 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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) 2007,
+ * @author Red Hat Middleware LLC.
+ */
+package org.jboss.jbossts.xts.recovery.coordinator.at;
+
+import org.jboss.jbossts.xts.logging.XTSLogger;
+import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager;
+
+import com.arjuna.ats.arjuna.recovery.RecoveryModule;
+import com.arjuna.ats.arjuna.recovery.TransactionStatusConnectionManager;
+import com.arjuna.ats.arjuna.logging.FacilityCode;
+import com.arjuna.ats.arjuna.coordinator.TxControl;
+import com.arjuna.ats.arjuna.coordinator.ActionStatus;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.common.util.logging.DebugLevel;
+import com.arjuna.common.util.logging.VisibilityLevel;
+
+import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ACCoordinator;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+/**
+ * This class is a plug-in module for the recovery manager.
+ * It is responsible for recovering failed XTS (ACCoordinator) transactions.
+ *
+ * Responsible for recovering instances of XTS Transaction Coordinators
+ * (com.arjuna.mwlabs.wscf.model.as.coordinator.arjunacore.ACCoordinator)
+ * Modelled on com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule
+ * TODO: refactor this and AtomicActionRecoveryModule to remove duplication?
+ *
+ * $Id$
+ *
+ * @message org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_1 [org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_1] - RecoveryManagerStatusModule: Object store exception: {0}
+ * @message org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_2 [org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_2] - failed to recover Transaction {0} {1}
+ * @message org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_3 [org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_3] - failed to access transaction store {0} {1}
+ */
+public class ACCoordinatorRecoveryModule implements RecoveryModule
+{
+ public ACCoordinatorRecoveryModule()
+ {
+ if (XTSLogger.arjLogger.isDebugEnabled())
+ {
+ XTSLogger.arjLogger.debug
+ ( DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "ACCoordinatorRecoveryModule created - default" );
+ }
+
+ if (_transactionStore == null)
+ {
+ _transactionStore = TxControl.getStore() ;
+ }
+
+ _transactionStatusConnectionMgr = new TransactionStatusConnectionManager() ;
+ }
+
+ /**
+ * called by the service startup code before the recovery module is added to the recovery managers
+ * module list
+ */
+ public void install()
+ {
+ Implementations.install();
+ }
+
+ /**
+ * module list in order to allow the implementations list to be purged of this module's implementations
+ */
+ public void uninstall()
+ {
+ Implementations.uninstall();
+ }
+
+ /**
+ * This is called periodically by the RecoveryManager
+ */
+ public void periodicWorkFirstPass()
+ {
+ // Transaction type
+ boolean ACCoordinators = false ;
+
+ // uids per transaction type
+ InputObjectState acc_uids = new InputObjectState() ;
+
+ try
+ {
+ if (XTSLogger.arjLogger.isDebugEnabled())
+ {
+ XTSLogger.arjLogger.debug( "StatusModule: first pass " );
+ }
+
+ ACCoordinators = _transactionStore.allObjUids( _transactionType, acc_uids );
+
+ }
+ catch ( ObjectStoreException ex )
+ {
+ if (XTSLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ XTSLogger.arjLoggerI18N.warn("org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_1",
+ new Object[]{ex});
+ }
+ }
+
+ if ( ACCoordinators )
+ {
+ _transactionUidVector = processTransactions( acc_uids ) ;
+ }
+ }
+
+ public void periodicWorkSecondPass()
+ {
+ if (XTSLogger.arjLogger.isDebugEnabled())
+ {
+ XTSLogger.arjLogger.debug( "ACCoordinatorRecoveryModule: Second pass " );
+ }
+
+ if (_transactionUidVector != null) {
+ processTransactionsStatus() ;
+ }
+
+ // ok notify the coordinator processor that recovery processing has completed
+
+ }
+
+ protected ACCoordinatorRecoveryModule (String type)
+ {
+ if (XTSLogger.arjLogger.isDebugEnabled())
+ {
+ XTSLogger.arjLogger.debug
+ ( DebugLevel.CONSTRUCTORS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "ACCoordinatorRecoveryModule created " + type );
+ }
+
+ if (_transactionStore == null)
+ {
+ _transactionStore = TxControl.getStore() ;
+ }
+
+ _transactionStatusConnectionMgr = new TransactionStatusConnectionManager() ;
+ _transactionType = type;
+
+ }
+
+ private void doRecoverTransaction( Uid recoverUid )
+ {
+ boolean commitThisTransaction = true ;
+
+ // Retrieve the transaction status from its original process.
+ // n.b. for a non-active XTS TX this status wil l always be committed even
+ // if it aborted or had a heuristic outcome. in that case we need to use
+ // the logged action status which can only be retrieved after activation
+
+ int theStatus = _transactionStatusConnectionMgr.getTransactionStatus( _transactionType, recoverUid ) ;
+
+ boolean inFlight = isTransactionInMidFlight( theStatus ) ;
+
+ String Status = ActionStatus.stringForm( theStatus ) ;
+
+ if (XTSLogger.arjLogger.isDebugEnabled())
+ {
+ XTSLogger.arjLogger.debug
+ ( DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "transaction type is "+ _transactionType + " uid is " +
+ recoverUid.toString() + "\n ActionStatus is " + Status +
+ " in flight is " + inFlight ) ;
+ }
+
+ if ( ! inFlight )
+ {
+ try
+ {
+ XTSLogger.arjLogger.debug( DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY, "jjh doing revovery here for "+recoverUid);
+ // TODO jjh
+ RecoverACCoordinator rcvACCoordinator =
+ new RecoverACCoordinator(recoverUid);
+// RecoverAtomicAction rcvAtomicAction =
+// new RecoverAtomicAction( recoverUid, theStatus ) ;
+
+// rcvAtomicAction.replayPhase2() ;
+ rcvACCoordinator.replayPhase2();
+ }
+ catch ( Exception ex )
+ {
+ if (XTSLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ XTSLogger.arjLoggerI18N.warn("org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_2",
+ new Object[]{recoverUid.toString(), ex});
+ }
+ }
+ }
+ }
+
+ private boolean isTransactionInMidFlight( int status )
+ {
+ boolean inFlight = false ;
+
+ switch ( status )
+ {
+ // these states can only come from a process that is still alive
+ case ActionStatus.RUNNING :
+ case ActionStatus.ABORT_ONLY :
+ case ActionStatus.PREPARING :
+ case ActionStatus.COMMITTING :
+ case ActionStatus.ABORTING :
+ case ActionStatus.PREPARED :
+ inFlight = true ;
+ break ;
+
+ // the transaction is apparently still there, but has completed its
+ // phase2. should be safe to redo it.
+ case ActionStatus.COMMITTED :
+ case ActionStatus.H_COMMIT :
+ case ActionStatus.H_MIXED :
+ case ActionStatus.H_HAZARD :
+ case ActionStatus.ABORTED :
+ case ActionStatus.H_ROLLBACK :
+ inFlight = false ;
+ break ;
+
+ // this shouldn't happen
+ case ActionStatus.INVALID :
+ default:
+ inFlight = false ;
+ }
+
+ return inFlight ;
+ }
+
+ private Vector processTransactions( InputObjectState uids )
+ {
+ Vector uidVector = new Vector() ;
+
+ if (XTSLogger.arjLogger.isDebugEnabled())
+ {
+ XTSLogger.arjLogger.debug( DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "processing " + _transactionType
+ + " transactions" ) ;
+ }
+
+ Uid theUid = new Uid( Uid.nullUid() );
+
+ boolean moreUids = true ;
+
+ while (moreUids)
+ {
+ try
+ {
+ theUid.unpack( uids ) ;
+
+ if (theUid.equals( Uid.nullUid() ))
+ {
+ moreUids = false;
+ }
+ else
+ {
+ Uid newUid = new Uid( theUid ) ;
+
+ if (XTSLogger.arjLogger.isDebugEnabled())
+ {
+ XTSLogger.arjLogger.debug
+ ( DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "found transaction "+ newUid ) ;
+ }
+
+ uidVector.addElement( newUid ) ;
+ }
+ }
+ catch ( Exception ex )
+ {
+ moreUids = false;
+ }
+ }
+ return uidVector ;
+ }
+
+ private void processTransactionsStatus()
+ {
+ // Process the Vector of transaction Uids
+ Enumeration transactionUidEnum = _transactionUidVector.elements() ;
+
+ while ( transactionUidEnum.hasMoreElements() )
+ {
+ Uid currentUid = (Uid) transactionUidEnum.nextElement();
+
+ try
+ {
+ if ( _transactionStore.currentState( currentUid, _transactionType ) != ObjectStore.OS_UNKNOWN )
+ {
+ doRecoverTransaction( currentUid ) ;
+ }
+ }
+ catch ( ObjectStoreException ex )
+ {
+ if (XTSLogger.arjLogger.isWarnEnabled())
+ {
+ XTSLogger.arjLoggerI18N.warn("org.jboss.transactions.xts.recovery.coordinator.at.ACCoordinatorRecoveryModule_3",
+ new Object[]{currentUid.toString(), ex});
+ }
+ }
+ }
+
+ XTSATRecoveryManager.getRecoveryManager().setCoordinatorRecoveryStarted();
+ }
+
+ // 'type' within the Object Store for ACCoordinator.
+ private String _transactionType = new ACCoordinator().type() ;
+
+ // Array of transactions found in the object store of the
+ // ACCoordinator type.
+ private Vector _transactionUidVector = null ;
+
+ // Reference to the Object Store.
+ private static ObjectStore _transactionStore = null ;
+
+ // This object manages the interface to all TransactionStatusManagers
+ // processes(JVMs) on this system/node.
+ private TransactionStatusConnectionManager _transactionStatusConnectionMgr ;
+
+}
+
Copied: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/Implementations.java (from rev 23495, labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/Implementations.java)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/Implementations.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/Implementations.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -0,0 +1,57 @@
+/*
+ * 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 org.jboss.jbossts.xts.recovery.coordinator.at;
+
+import com.arjuna.ats.arjuna.gandiva.inventory.Inventory;
+
+/**
+ * Module specific class that is responsible for adding any implementations
+ * to the inventory.
+ *
+ * @author Mark Little (mark at arjuna.com)
+ * @version $Id: Implementations.java 2342 2006-03-30 13:06:17Z $
+ * @since JTS 1.0.
+ */
+public class Implementations {
+
+ static ParticipantRecordSetup _inventoryItem = null;
+
+ public static synchronized void install ()
+ {
+ if (_inventoryItem == null) {
+ _inventoryItem = new ParticipantRecordSetup();
+ // WS-AT Participant records.
+ Inventory.inventory().addToList(_inventoryItem);
+ }
+ }
+
+ public static synchronized void uninstall()
+ {
+ if (_inventoryItem != null) {
+ Inventory.inventory().removeFromList(_inventoryItem.className());
+ }
+ }
+
+ private Implementations ()
+ {
+ }
+}
Copied: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ParticipantRecordSetup.java (from rev 23495, labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/ParticipantRecordSetup.java)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ParticipantRecordSetup.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/ParticipantRecordSetup.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -0,0 +1,75 @@
+/*
+ * 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 org.jboss.jbossts.xts.recovery.coordinator.at;
+
+import com.arjuna.ats.arjuna.gandiva.inventory.InventoryElement;
+import com.arjuna.ats.arjuna.gandiva.ClassName;
+import com.arjuna.ats.arjuna.gandiva.ObjectName;
+import com.arjuna.ats.arjuna.coordinator.RecordType;
+
+import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ParticipantRecord;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jhalli
+ * Date: Aug 20, 2007
+ * Time: 3:18:23 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ParticipantRecordSetup implements InventoryElement {
+
+ public synchronized Object createVoid ()
+ {
+ return ParticipantRecord.create();
+ }
+
+ public synchronized Object createClassName (ClassName className)
+ {
+ return null;
+ }
+
+ public synchronized Object createObjectName (ObjectName objectName)
+ {
+ return null;
+ }
+
+ public synchronized Object createResources (Object[] resources)
+ {
+ return null;
+ }
+
+ public synchronized Object createClassNameResources (ClassName className, Object[] resources)
+ {
+ return null;
+ }
+
+ public synchronized Object createObjectNameResources (ObjectName objectName, Object[] resources)
+ {
+ return null;
+ }
+
+ public ClassName className ()
+ {
+ return RecordType.typeToClassName(RecordType.USER_DEF_FIRST0);
+ //ClassName("WSATParticipantRecord"); // TODO remove dupl with ParticipantRecord
+ }
+
+}
Copied: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverACCoordinator.java (from rev 23495, labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/RecoverACCoordinator.java)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverACCoordinator.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/recovery/coordinator/at/RecoverACCoordinator.java 2008-10-17 13:03:49 UTC (rev 23496)
@@ -0,0 +1,105 @@
+package org.jboss.jbossts.xts.recovery.coordinator.at;
+
+import org.jboss.jbossts.xts.logging.XTSLogger;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.logging.FacilityCode;
+import com.arjuna.ats.arjuna.coordinator.ActionStatus;
+
+import com.arjuna.mwlabs.wscf.model.twophase.arjunacore.ACCoordinator;
+import com.arjuna.common.util.logging.DebugLevel;
+import com.arjuna.common.util.logging.VisibilityLevel;
+
+/**
+ * This class is a plug-in module for the recovery manager.
+ * It is responsible for recovering failed ACCoordinator transactions.
+ *
+ * @message org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_1 [org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_1] - RecoverACCoordinator.replayPhase2 recovering {0} ActionStatus is {1}
+ * @message org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_2 [org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_2] - RecoverACCoordinator.replayPhase2: Unexpected status: {0}
+ * @message org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_3 [org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_3] - RecoverACCoordinator.replayPhase2( {0} ) finished
+ * @message org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_4 [org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_4] - RecoverACCoordinator.replayPhase2 transaction {0} not activated, unable to replay phase 2 commit
+*/
+public class RecoverACCoordinator extends ACCoordinator {
+
+ // TODO: refactor RecoverAtomicAction so that this can subclass it to remove dupl?
+
+ /**
+ * Re-creates/activates an AtomicAction for the specified
+ * transaction Uid.
+ */
+ public RecoverACCoordinator ( Uid rcvUid )
+ {
+ super( rcvUid ) ;
+ _activated = activate() ;
+ }
+
+ /**
+ * Replays phase 2 of the commit protocol.
+ */
+ public void replayPhase2()
+ {
+ final int status = status();
+
+ if (XTSLogger.arjLoggerI18N.debugAllowed())
+ {
+ XTSLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_1",
+ new Object[]{get_uid(), ActionStatus.stringForm(status)});
+ }
+
+ if ( _activated )
+ {
+ // we only need to rerun phase2 if the action status is PREPARED, which happens
+ // when we crash before or during commit, or COMMITTING, which happens when we get
+ // a comms timeout from one of the participants after sending it a COMMIT message.
+ // in the former case all participant records will be listed in the prepared list.
+ // in the latter case the failed participant record(s) will have been reinstated in the
+ // prepared list and the participant stub engine reactivated, where necessary,
+ // under the call to activate() when this coordinator was created.
+
+ // we can also arrive here when the action status is ABORTING. This happens when we
+ // get a comms timeout from one of the participants after sending it a PREPARE message
+ // or if we get a comms timeout from one of the participants after sending it a ROLLBACK
+ // message. In either case the failed participant record(s) will be listed in the heuristic
+ // list. Since this list is ignored completely by phase2Abort there is no point doing
+ // anything here. there are also cases where actionStatus is a heuristic outcome. Once
+ // again it is pointless calling phase2Abort since the prepared list is empty.
+
+ if ((status == ActionStatus.PREPARED) ||
+ (status == ActionStatus.COMMITTING) ||
+ (status == ActionStatus.COMMITTED) ||
+ (status == ActionStatus.H_COMMIT) ||
+ (status == ActionStatus.H_MIXED) ||
+ (status == ActionStatus.H_HAZARD))
+ {
+ super.phase2Commit( _reportHeuristics ) ;
+ } else if ((status == ActionStatus.ABORTED) ||
+ (status == ActionStatus.H_ROLLBACK) ||
+ (status == ActionStatus.ABORTING) ||
+ (status == ActionStatus.ABORT_ONLY))
+ {
+ super.phase2Abort( _reportHeuristics ) ;
+ }
+
+ if (XTSLogger.arjLoggerI18N.debugAllowed())
+ {
+ XTSLogger.arjLoggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
+ "org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_3",
+ new Object[]{get_uid()});
+ }
+ }
+ else
+ {
+ XTSLogger.arjLoggerI18N.warn("org.jboss.jbossts.xts.recovery.coordinator.at.RecoverACCoordinator_4", new Object[]{get_uid()});
+ }
+ }
+
+ // Flag to indicate that this transaction has been re-activated
+ // successfully.
+ private boolean _activated = false ;
+
+ // whether heuristic reporting on phase 2 commit is enabled.
+ private boolean _reportHeuristics = true ;
+}
More information about the jboss-svn-commits
mailing list