Repository: logging-log4j2 Updated Branches: refs/heads/master 6f4620a0c -> ef775677c
The old code did not do what the comment suggested WRT "killing" the thread from the ES. Now use the new sushutdown ES method, which will try to force the thread to stop if waiting a bit does not let it end. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/ef775677 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/ef775677 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/ef775677 Branch: refs/heads/master Commit: ef775677c53f6e195816bf5e0bca1ea05cfcb49c Parents: 6f4620a Author: Gary Gregory <[email protected]> Authored: Mon Sep 5 20:32:00 2016 -0400 Committer: Gary Gregory <[email protected]> Committed: Mon Sep 5 20:32:00 2016 -0400 ---------------------------------------------------------------------- .../logging/log4j/core/async/AsyncLoggerConfigDisruptor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ef775677/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java index f3565a1..1b3beb5 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigDisruptor.java @@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.async; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; @@ -28,6 +29,7 @@ import org.apache.logging.log4j.core.impl.LogEventFactory; import org.apache.logging.log4j.core.impl.MutableLogEvent; import org.apache.logging.log4j.core.impl.ReusableLogEventFactory; import org.apache.logging.log4j.core.jmx.RingBufferAdmin; +import org.apache.logging.log4j.core.util.ExecutorServices; import org.apache.logging.log4j.core.util.Log4jThreadFactory; import org.apache.logging.log4j.message.ReusableMessage; import org.apache.logging.log4j.status.StatusLogger; @@ -262,7 +264,8 @@ public class AsyncLoggerConfigDisruptor implements AsyncLoggerConfigDelegate { temp.shutdown(); // busy-spins until all events currently in the disruptor have been processed LOGGER.trace("AsyncLoggerConfigDisruptor: shutting down disruptor executor for this configuration."); - executor.shutdown(); // finally, kill the processor thread + // finally, kill the processor thread // TODO time should be picked up when stop(long, TimeUnit) is implemented. + ExecutorServices.shutdown(executor, 10, TimeUnit.SECONDS, toString()); executor = null; // release reference to allow GC if (DiscardingAsyncQueueFullPolicy.getDiscardCount(asyncQueueFullPolicy) > 0) {
