tabish121 commented on code in PR #4344:
URL: https://github.com/apache/activemq-artemis/pull/4344#discussion_r1088098728
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -213,9 +217,9 @@ public void awaitLiveNode() throws NodeManagerException,
InterruptedException {
logger.debug("awaiting live node failing back");
Thread.sleep(2000);
} else if (state == FileLockNodeManager.LIVE) {
- if (logger.isDebugEnabled()) {
- logger.debug("acquired live node lock state = {}", (char)
state);
- }
+ logger.debug("acquired live node lock state = {}", (char)
state);
+ serverLockFile.setLastModified(System.currentTimeMillis());
+ logger.debug("touched " + serverLockFile.getAbsoluteFile() + ";
new time: " + serverLockFile.lastModified());
Review Comment:
Logger should be using formatting as to string concatenations.
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -429,16 +435,19 @@ protected FileLock lock(final int lockPosition) throws
ActiveMQLockAcquisitionTi
FileLock lock = tryLock(lockPosition);
isRecurringFailure = false;
+ logger.debug("lock: " + lock);
Review Comment:
Fix logger formatting as above
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -554,9 +572,26 @@ public void run() {
logger.warn("Lost the lock according to the monitor, notifying
listeners");
notifyLostLock();
}
-
}
- }
+ private boolean hasBeenModified() {
+ boolean modified = false;
+
+ // Create a new instance of the File object so we can get the most
up-to-date information on the file.
+ File freshServerLockFile = new File(serverLockFile.getAbsolutePath());
+ if (freshServerLockFile.exists()) {
+ logger.debug(freshServerLockFile.lastModified() + " > " +
serverLockLastModified + "?");
+ if (freshServerLockFile.lastModified() > serverLockLastModified) {
+ logger.debug("Lock file " + serverLockFile.getAbsolutePath() +
" originally locked at " + new Date(serverLockLastModified) + " was modified at
" + new Date(freshServerLockFile.lastModified()));
Review Comment:
Fix logger formatting as above
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -554,9 +572,26 @@ public void run() {
logger.warn("Lost the lock according to the monitor, notifying
listeners");
notifyLostLock();
}
-
}
- }
+ private boolean hasBeenModified() {
+ boolean modified = false;
+
+ // Create a new instance of the File object so we can get the most
up-to-date information on the file.
+ File freshServerLockFile = new File(serverLockFile.getAbsolutePath());
+ if (freshServerLockFile.exists()) {
+ logger.debug(freshServerLockFile.lastModified() + " > " +
serverLockLastModified + "?");
+ if (freshServerLockFile.lastModified() > serverLockLastModified) {
+ logger.debug("Lock file " + serverLockFile.getAbsolutePath() +
" originally locked at " + new Date(serverLockLastModified) + " was modified at
" + new Date(freshServerLockFile.lastModified()));
+ modified = true;
+ }
+ } else {
+ logger.debug("Lock file " + serverLockFile.getAbsolutePath() + "
does not exist");
Review Comment:
Fix logger formatting as above
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -345,6 +349,8 @@ private void writeFileLockStatus(byte status) throws
NodeManagerException {
lock.release();
}
}
+ serverLockLastModified = serverLockFile.lastModified();
+ logger.debug("Modified " + serverLockFile.getName() + " at " +
serverLockLastModified);
Review Comment:
Fix logger formatting as above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]