Skip to content

Commit

Permalink
The UNIQUE_RMS_READY is a constant in fact, it cannot be null.
Browse files Browse the repository at this point in the history
Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Jan 31, 2024
1 parent 2353fa7 commit 9b1b352
Showing 1 changed file with 24 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public class RecoveryManager {
* This attribute is used by the Recovery Thread to know if the
* xaResource list is ready in case manual recovery is attempted.
*/
private static volatile EventSemaphore uniqueRMSetReady = new EventSemaphore();
private static final EventSemaphore UNIQUE_RMS_READY = new EventSemaphore();

private static Hashtable coordsByGlobalTID = new Hashtable();
private static Hashtable coordsByLocalTID = new Hashtable();
Expand Down Expand Up @@ -800,13 +800,7 @@ public static void recoverXAResources(Enumeration xaResources) {
}

synchronized (lockObject) {

if (uniqueRMSetReady.isPosted() == false) {
RecoveryManager.uniqueRMSet = getUniqueRMSet(xaResources);
uniqueRMSetReady.post();
waitForResync();
return;
} else {
if (UNIQUE_RMS_READY.isPosted()) {
RecoveryManager.waitForResync();
RecoveryManager.uniqueRMSet = getUniqueRMSet(xaResources);
// the following call is meant to induce recovery. But
Expand All @@ -816,7 +810,11 @@ public static void recoverXAResources(Enumeration xaResources) {
// from the coordinator to be able to support recovery
// during TP processing.
proceedWithXARecovery();
return;
}
RecoveryManager.uniqueRMSet = getUniqueRMSet(xaResources);
UNIQUE_RMS_READY.post();
waitForResync();
}
}

Expand Down Expand Up @@ -904,18 +902,15 @@ private static void proceedWithXARecovery() {
}

if (Thread.currentThread().getName().equals("JTS Resync Thread"/*#Frozen*/)) {

if (uniqueRMSetReady != null) {
try {
uniqueRMSetReady.waitEvent();
txRecoveryFence.raiseFence();
xaResources = RecoveryManager.uniqueRMSet;
} catch (InterruptedException exc) {
_logger.log(Level.SEVERE,"jts.wait_for_resync_complete_interrupted");
String msg = LogFormatter.getLocalizedMessage(_logger,
"jts.wait_for_resync_complete_interrupted");
throw new org.omg.CORBA.INTERNAL(msg);
}
try {
UNIQUE_RMS_READY.waitEvent();
txRecoveryFence.raiseFence();
xaResources = RecoveryManager.uniqueRMSet;
} catch (InterruptedException exc) {
_logger.log(Level.SEVERE,"jts.wait_for_resync_complete_interrupted");
String msg = LogFormatter.getLocalizedMessage(_logger,
"jts.wait_for_resync_complete_interrupted");
throw new org.omg.CORBA.INTERNAL(msg);
}
}

Expand Down Expand Up @@ -1095,17 +1090,15 @@ static void dbXARecovery() {
}

if (Thread.currentThread().getName().equals("JTS Resync Thread"/*#Frozen*/)) {
if (uniqueRMSetReady != null) {
try {
_logger.fine("dbXArecovery()");
uniqueRMSetReady.waitEvent();
xaResources = RecoveryManager.uniqueRMSet;
} catch (InterruptedException exc) {
_logger.log(Level.SEVERE,"jts.wait_for_resync_complete_interrupted");
String msg = LogFormatter.getLocalizedMessage(_logger,
"jts.wait_for_resync_complete_interrupted");
throw new org.omg.CORBA.INTERNAL(msg);
}
try {
_logger.fine("dbXArecovery()");
UNIQUE_RMS_READY.waitEvent();
xaResources = RecoveryManager.uniqueRMSet;
} catch (InterruptedException exc) {
_logger.log(Level.SEVERE,"jts.wait_for_resync_complete_interrupted");
String msg = LogFormatter.getLocalizedMessage(_logger,
"jts.wait_for_resync_complete_interrupted");
throw new org.omg.CORBA.INTERNAL(msg);
}
}

Expand Down

0 comments on commit 9b1b352

Please sign in to comment.