restoringMessages = false;
break;
}
String senderNode = null;
ODistributedRequest message = null;
try {
message = readRequest();
if (message != null) {
// DECIDE TO USE THE HZ MAP ONLY IF THE COMMAND IS NOT IDEMPOTENT (ALL BUT READ-RECORD/SQL SELECT/SQL TRAVERSE
// final boolean saveAsPending = !message.getTask().isIdempotent();
// if (saveAsPending)
// SAVE THE MESSAGE IN TO THE UNDO MAP IN CASE OF FAILURE
// lastPendingMessagesMap.put(databaseName, message);
senderNode = message.getSenderNodeName();
onMessage(message);
// if (saveAsPending)
// OK: REMOVE THE UNDO BUFFER
// lastPendingMessagesMap.remove(databaseName);
}
} catch (InterruptedException e) {
// EXIT CURRENT THREAD
Thread.interrupted();
break;
} catch (DistributedObjectDestroyedException e) {
Thread.interrupted();
break;
} catch (HazelcastInstanceNotActiveException e) {
Thread.interrupted();
break;
} catch (HazelcastException e) {
if (e.getCause() instanceof InterruptedException)
Thread.interrupted();
else
ODistributedServerLog.error(this, manager.getLocalNodeName(), senderNode, DIRECTION.IN,
"error on executing distributed request %d: %s", e, message != null ? message.getId() : -1,
message != null ? message.getTask() : "-");
} catch (Throwable e) {
ODistributedServerLog.error(this, getLocalNodeName(), senderNode, DIRECTION.IN,
"error on executing distributed request %d: %s", e, message != null ? message.getId() : -1,
message != null ? message.getTask() : "-");
}
}
ODistributedServerLog.debug(this, manager.getLocalNodeName(), null, DIRECTION.NONE, "end of reading requests for database %s",
databaseName);