You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/06/10 17:32:03 UTC

logging-log4j2 git commit: LOG4J2-1048 FileConfigurationMonitor unnecessarily calls System.currentTimeMillis causing high CPU usage.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 1765760ab -> 4c95866dc


LOG4J2-1048 FileConfigurationMonitor unnecessarily calls
System.currentTimeMillis causing high CPU usage.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4c95866d
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4c95866d
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4c95866d

Branch: refs/heads/master
Commit: 4c95866dc3fcfa109730c9843da144c5bf4599ae
Parents: 1765760
Author: rpopma <rp...@apache.org>
Authored: Thu Jun 11 00:32:14 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Jun 11 00:32:14 2015 +0900

----------------------------------------------------------------------
 .../logging/log4j/core/config/FileConfigurationMonitor.java      | 4 ++--
 src/changes/changes.xml                                          | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4c95866d/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
index 38f64cf..f145696 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
@@ -73,8 +73,8 @@ public class FileConfigurationMonitor implements ConfigurationMonitor {
      */
     @Override
     public void checkConfiguration() {
-        final long current = System.currentTimeMillis();
-        if (((counter.incrementAndGet() & MASK) == 0) && (current >= nextCheck)) {
+        final long current;
+        if (((counter.incrementAndGet() & MASK) == 0) && ((current = System.currentTimeMillis()) >= nextCheck)) {
             LOCK.lock();
             try {
                 nextCheck = current + intervalSeconds;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4c95866d/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index eef3aa4..e22441f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.4" date="2015-MM-DD" description="GA Release 2.4">
+      <action issue="LOG4J2-1048" dev="rpopma" type="fix" due-to="Nikhil">
+        FileConfigurationMonitor unnecessarily calls System.currentTimeMillis causing high CPU usage.
+      </action>
       <action issue="LOG4J2-1023" dev="ggregory" type="add" due-to="Mikael Ståldal">
         New RewritePolicy for changing level of a log event.
       </action>