You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2016/09/07 00:09:46 UTC

logging-log4j2 git commit: [LOG4J2-1259] Log4j threads are leaking on tomcat shutdown. Simplify cancelling future task.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master ea302f26a -> 46d7cb4c4


[LOG4J2-1259] Log4j threads are leaking on tomcat shutdown. Simplify
cancelling future task.

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

Branch: refs/heads/master
Commit: 46d7cb4c497357be0690e2eaf2edb68818fa8a21
Parents: ea302f2
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Sep 6 20:09:44 2016 -0400
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Sep 6 20:09:44 2016 -0400

----------------------------------------------------------------------
 .../log4j/core/appender/rolling/CronTriggeringPolicy.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/46d7cb4c/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java
index 288223c..8d8bba7 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java
@@ -143,15 +143,15 @@ public final class CronTriggeringPolicy extends AbstractLifeCycle implements Tri
     @Override
     public boolean stop(long timeout, TimeUnit timeUnit) {
         setStopping();
+        boolean canceled = true;
         if (future != null) {
-            try {
-                future.get(timeout, timeUnit);
-            } catch (InterruptedException | ExecutionException | TimeoutException e) {
-                future.cancel(true);
+            if (future.isCancelled() || future.isDone()) {
+                return true;
             }
+            canceled = future.cancel(true);
         }
         setStopped();
-        return true;
+        return canceled;
     }
 
     @Override