Skip to content

Commit

Permalink
It may be appropriate to throw an UNKNOWN exception if we don't know …
Browse files Browse the repository at this point in the history
…what happened during the rollback
  • Loading branch information
tomjenkinson committed Nov 15, 2024
1 parent 291126b commit 8c1b75c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public void rollback() throws org.omg.CORBA.SystemException,
}
}

boolean removeConnection = true;
// This is used to ensure that if xa_rollback fails
boolean destroyState = true;
try {
Expand Down Expand Up @@ -400,7 +401,10 @@ public void rollback() throws org.omg.CORBA.SystemException,
*/
destroyState = false;
}
break;
removeConnection = false;
// We don't want to report a heuristic as we don't know it won't rollback so throw UNKNOWN
// (noting we end up in the finally for further processing)
throw new UNKNOWN();
case XAException.XAER_NOTA:
if (_phaseTwoStarted) {
// rolled back previously and recovery completed
Expand All @@ -427,7 +431,9 @@ public void rollback() throws org.omg.CORBA.SystemException,
if (_prepared && destroyState) {
destroyState();
} else {
removeConnection();
if (removeConnection) {
removeConnection();
}
}
}
}
Expand Down

0 comments on commit 8c1b75c

Please sign in to comment.