add check for the remove of the lock manager node to avoid execution of distributed lock operation on unreachable node
@@ -1500,6 +1500,23 @@ public class OHazelcastPlugin extends ODistributedAbstractPlugin
ODistributedServerLog
.debug(this, nodeName, nodeLeftName, DIRECTION.NONE, "Distributed server '%s' is unreachable", nodeLeftName);
+ try {
+ if (nodeLeftName.equals(getLockManagerRequester().getServer()))
+ electNewLockManager();
+
+ getLockManagerExecutor().handleUnreachableServer(nodeLeftName);
+ getLockManagerRequester().handleUnreachableServer(nodeLeftName);
+
+ } catch (Exception e) {
+ // IGNORE IT
+ ODistributedServerLog.debug(this, nodeName, nodeLeftName, DIRECTION.NONE, "Error on electing new lockManager", e);
+ }
+
+ if (nodeLeftName.equals(getLockManagerRequester().getServer())) {
+ // IF AFTER RE-ELECTION THE DISTRIBUTED LOCK MANAGER IS STILL THE REMOVED SERVER ABORT REMOVE.
+ return;
+ }
+
try {
// REMOVE INTRA SERVER CONNECTION
closeRemoteServer(nodeLeftName);
@@ -1510,14 +1527,10 @@ public class OHazelcastPlugin extends ODistributedAbstractPlugin
l.onNodeLeft(nodeLeftName);
} catch (Exception e) {
// IGNORE IT
+ ODistributedServerLog
+ .debug(this, nodeName, nodeLeftName, DIRECTION.NONE, "Error on calling onNodeLeft event on '%s'", e, l);
}
- if (nodeLeftName.equals(getLockManagerRequester().getServer()))
- electNewLockManager();
-
- getLockManagerExecutor().handleUnreachableServer(nodeLeftName);
- getLockManagerRequester().handleUnreachableServer(nodeLeftName);
-
// UNLOCK ANY PENDING LOCKS
if (messageService != null) {
for (String dbName : messageService.getDatabases())
