activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: add trace level log to shared file locker keepAlive
Date Thu, 04 Feb 2016 13:30:33 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 8c4b5f485 -> c17b7fdc7


add trace level log to shared file locker keepAlive


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/c17b7fdc
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/c17b7fdc
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/c17b7fdc

Branch: refs/heads/master
Commit: c17b7fdc7fbe6eaaf798db19fc3d698b8364f5e7
Parents: 8c4b5f4
Author: gtully <gary.tully@gmail.com>
Authored: Thu Feb 4 13:28:23 2016 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Thu Feb 4 13:28:59 2016 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/activemq/store/SharedFileLocker.java | 7 ++++++-
 .../java/org/apache/activemq/store/SharedFileLockerTest.java  | 5 ++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/c17b7fdc/activemq-broker/src/main/java/org/apache/activemq/store/SharedFileLocker.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/store/SharedFileLocker.java
b/activemq-broker/src/main/java/org/apache/activemq/store/SharedFileLocker.java
index 025510b..c25a4be 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/store/SharedFileLocker.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/store/SharedFileLocker.java
@@ -94,7 +94,9 @@ public class SharedFileLocker extends AbstractLocker {
 
     @Override
     public boolean keepAlive() {
-        return lockFile != null && lockFile.keepAlive();
+        boolean result = lockFile != null && lockFile.keepAlive();
+        LOG.trace("keepAlive result: " + result + (name != null ? ", name: " + name : ""));
+        return result;
     }
 
     @Override
@@ -116,5 +118,8 @@ public class SharedFileLocker extends AbstractLocker {
     @Override
     public void configure(PersistenceAdapter persistenceAdapter) throws IOException {
         this.setDirectory(persistenceAdapter.getDirectory());
+        if (name == null) {
+            name = getDirectory().toString();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/c17b7fdc/activemq-unit-tests/src/test/java/org/apache/activemq/store/SharedFileLockerTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/SharedFileLockerTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/SharedFileLockerTest.java
index ac8b86e..c22ec80 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/SharedFileLockerTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/SharedFileLockerTest.java
@@ -32,6 +32,7 @@ import org.apache.activemq.util.IOHelper;
 import org.apache.activemq.util.LockFile;
 import org.apache.activemq.util.ServiceStopper;
 import org.apache.activemq.util.Wait;
+import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.spi.LoggingEvent;
 import org.junit.Assert;
@@ -88,7 +89,9 @@ public class SharedFileLockerTest {
         DefaultTestAppender appender = new DefaultTestAppender() {
             @Override
             public void doAppend(LoggingEvent event) {
-                logCounts.incrementAndGet();
+                if (event.getLevel() == Level.INFO) {
+                    logCounts.incrementAndGet();
+                }
             }
         };
 


Mime
View raw message