Fix ExecutorServices documentation and usage of timeout = 0
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4df3a6b0 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4df3a6b0 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4df3a6b0 Branch: refs/heads/LOG4J2-1390 Commit: 4df3a6b051ff1c44b7fcf56cb9f1c63151564510 Parents: 1e322e4 Author: Mikael Ståldal <[email protected]> Authored: Thu Oct 6 13:17:10 2016 +0200 Committer: Mikael Ståldal <[email protected]> Committed: Thu Oct 6 13:17:10 2016 +0200 ---------------------------------------------------------------------- .../java/org/apache/logging/log4j/core/LoggerContext.java | 8 ++++---- .../org/apache/logging/log4j/core/util/ExecutorServices.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4df3a6b0/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java index 7e13963..cc9ac38 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java @@ -16,8 +16,6 @@ */ package org.apache.logging.log4j.core; -import static org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.SHUTDOWN_HOOK_MARKER; - import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; @@ -38,7 +36,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.ConfigurationFactory; import org.apache.logging.log4j.core.config.ConfigurationListener; -import org.apache.logging.log4j.core.config.ConfigurationSource; // SUPPRESS CHECKSTYLE +import org.apache.logging.log4j.core.config.ConfigurationSource; import org.apache.logging.log4j.core.config.DefaultConfiguration; import org.apache.logging.log4j.core.config.NullConfiguration; import org.apache.logging.log4j.core.config.Reconfigurable; @@ -56,6 +54,8 @@ import org.apache.logging.log4j.spi.LoggerRegistry; import org.apache.logging.log4j.spi.Terminable; import org.apache.logging.log4j.util.PropertiesUtil; +import static org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.SHUTDOWN_HOOK_MARKER; + /** * The LoggerContext is the anchor for the logging system. It maintains a list of all the loggers requested by * applications and a reference to the Configuration. The Configuration will contain the configured loggers, appenders, @@ -336,7 +336,7 @@ public class LoggerContext extends AbstractLifeCycle final String source = "LoggerContext \'" + getName() + "\'"; shutdownEs = ExecutorServices.shutdown(executorService, timeout, timeUnit, source); // Do not wait for daemon threads - shutdownEsd = ExecutorServices.shutdown(executorServiceDeamons, -1, timeUnit, source); + shutdownEsd = ExecutorServices.shutdown(executorServiceDeamons, 0, timeUnit, source); } finally { configLock.unlock(); this.setStopped(); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4df3a6b0/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java index 4214c6f..37a44f5 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/ExecutorServices.java @@ -30,13 +30,13 @@ public class ExecutorServices { * Shuts down the given {@link ExecutorService} in an orderly fashion. Disables new tasks from submission and then * waits for existing tasks to terminate. Eventually cancels running tasks if too much time elapses. * <p> - * If the timeout is < 0, then a plain shutdown takes place. + * If the timeout is 0, then a plain shutdown takes place. * </p> * * @param executorService * the pool to shutdown. * @param timeout - * the maximum time to wait + * the maximum time to wait, or 0 to not wait for existing tasks to terminate. * @param timeUnit * the time unit of the timeout argument * @param source
