[jboss-svn-commits] JBL Code SVN: r31550 - labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Feb 10 10:39:22 EST 2010
Author: adinn
Date: 2010-02-10 10:39:21 -0500 (Wed, 10 Feb 2010)
New Revision: 31550
Modified:
labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java
labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java
Log:
corrected timing issue rolling forward participant state at BA complete. now ensures it does not change to state COMPLETED until the log is written and doesnot end the activity until any log record is deleted -- fixes JBTM-703
Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java 2010-02-10 14:37:06 UTC (rev 31549)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java 2010-02-10 15:39:21 UTC (rev 31550)
@@ -433,7 +433,6 @@
(current == State.STATE_FAILING_COMPLETING) || (current == State.STATE_FAILING_COMPENSATING))
{
deleteRequired = persisted;
- ended() ;
}
}
// if we just ended the participant ensure any log record gets deleted
@@ -447,6 +446,12 @@
}
}
}
+ // now we have removed the log record we can safely get rid of the participant
+ if ((current == State.STATE_FAILING_ACTIVE) || (current == State.STATE_FAILING_CANCELING) ||
+ (current == State.STATE_FAILING_COMPLETING) || (current == State.STATE_FAILING_COMPENSATING))
+ {
+ ended();
+ }
}
/**
@@ -618,16 +623,13 @@
*/
public State completed()
{
+ // TODO -- check. not sure this can or should ever be called for a coordinator completion participant
State current ;
boolean failRequired = false;
boolean deleteRequired = false;
synchronized(this)
{
current = state ;
- if (current == State.STATE_COMPLETING)
- {
- changeState(State.STATE_COMPLETED) ;
- }
}
if (current == State.STATE_COMPLETING) {
@@ -650,8 +652,9 @@
synchronized(this)
{
current = state ;
- if (current == State.STATE_COMPLETED) {
+ if (current == State.STATE_COMPLETING) {
if (!failRequired) {
+ changeState(State.STATE_COMPLETED);
// record the fact that we have persisted this object so later operations will delete
// the log record
persisted = true;
@@ -1361,11 +1364,8 @@
synchronized (this)
{
current = state ;
- if (current == State.STATE_COMPLETING)
- {
- changeState(State.STATE_COMPLETED) ;
- }
}
+
if (current == State.STATE_COMPLETING)
{
// ok we need to write the participant details to disk because it has just completed
@@ -1388,8 +1388,9 @@
synchronized(this)
{
current = state ;
- if (current == State.STATE_COMPLETED) {
+ if (current == State.STATE_COMPLETING) {
if (!failRequired) {
+ changeState(State.STATE_COMPLETED) ;
// record the fact that we have persisted this object so later operations will delete
// the log record
persisted = true;
@@ -1417,7 +1418,7 @@
WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.completed_2", new Object[] {id}) ;
}
}
- } else if ((current == State.STATE_COMPLETING) || (current == State.STATE_COMPLETED)) {
+ } else if (current == State.STATE_COMPLETING) {
sendCompleted() ;
}
}
@@ -1427,7 +1428,7 @@
*/
private void ended()
{
- changeState(State.STATE_ENDED) ;
+ changeState(State.STATE_ENDED) ;
CoordinatorCompletionParticipantProcessor.getProcessor().deactivateParticipant(this) ;
}
Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java 2010-02-10 14:37:06 UTC (rev 31549)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java 2010-02-10 15:39:21 UTC (rev 31550)
@@ -363,7 +363,6 @@
(current == State.STATE_FAILING_COMPENSATING))
{
deleteRequired = persisted;
- ended() ;
}
}
// if we just ended the participant ensure any log record gets deleted
@@ -377,6 +376,12 @@
}
}
}
+ // now the log record has been deleted we can safely end this participant
+ if ((current == State.STATE_FAILING_ACTIVE) || (current == State.STATE_FAILING_CANCELING) ||
+ (current == State.STATE_FAILING_COMPENSATING))
+ {
+ ended();
+ }
}
/**
@@ -550,46 +555,24 @@
synchronized(this)
{
current = state ;
- if (current == State.STATE_ACTIVE)
- {
- changeState(State.STATE_COMPLETED) ;
- }
- }
- if (current == State.STATE_ACTIVE) {
- // ok we need to write the participant details to disk because it has just completed
- BAParticipantRecoveryRecord recoveryRecord = new BAParticipantRecoveryRecord(id, participant, true, coordinator);
+ // we have to do this synchronized so that we don't try writing the participant details twice
- if (!XTSBARecoveryManager.getRecoveryManager().writeParticipantRecoveryRecord(recoveryRecord)) {
- // hmm, could not write entry log warning
- if (WSTLogger.arjLoggerI18N.isWarnEnabled())
- {
- WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.completed_1", new Object[] {id}) ;
- }
- // we need to fail this transaction
- failRequired = true;
- }
- }
- // recheck state before we decide whether we need to fail -- we might have been sent a cancel while
- // writing the log
+ if (current == State.STATE_ACTIVE) {
+ // ok we need to write the participant details to disk because it has just completed
+ BAParticipantRecoveryRecord recoveryRecord = new BAParticipantRecoveryRecord(id, participant, true, coordinator);
- synchronized(this)
- {
- current = state ;
- if (current == State.STATE_COMPLETED) {
- if (!failRequired) {
- // record the fact that we have persisted this object so later operations will delete
- // the log record
- persisted = true;
+ if (XTSBARecoveryManager.getRecoveryManager().writeParticipantRecoveryRecord(recoveryRecord)) {
+ changeState(State.STATE_COMPLETED);
} else {
- // we must force a fail but we don't have a log record to delete
- changeState(State.STATE_FAILING_ACTIVE);
+ // hmm, could not write entry log warning
+ if (WSTLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.completed_1", new Object[] {id}) ;
+ }
+ // we need to fail this transaction
+ failRequired = true;
}
- } else {
- // we cannot force a fail now so just delete
- failRequired = false;
- // we need to delete the log record here as the cancel would not have known it was persisted
- deleteRequired = true;
}
}
@@ -597,14 +580,6 @@
if (failRequired) {
current = fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME);
- } else if (deleteRequired) {
- if (!XTSBARecoveryManager.getRecoveryManager().deleteParticipantRecoveryRecord(id)) {
- // hmm, could not delete entry log warning
- if (WSTLogger.arjLoggerI18N.isWarnEnabled())
- {
- WSTLogger.arjLoggerI18N.warn("com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine.completed_2", new Object[] {id}) ;
- }
- }
} else if ((current == State.STATE_ACTIVE) || (current == State.STATE_COMPLETED)) {
sendCompleted() ;
}
More information about the jboss-svn-commits
mailing list