LOG4J2-1748 revert some changes
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/527b125c Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/527b125c Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/527b125c Branch: refs/heads/LOG4J2-1748and1780-remove-ExecutorService-from-LoggerContext Commit: 527b125c31e3ce654657bf7df5a9b2fc27d8ffd4 Parents: f6341ad Author: Mikael Ståldal <[email protected]> Authored: Sun Jan 15 17:18:39 2017 +0100 Committer: Mikael Ståldal <[email protected]> Committed: Sun Jan 15 17:18:39 2017 +0100 ---------------------------------------------------------------------- .../java/org/apache/logging/log4j/core/LoggerContext.java | 4 ++-- .../logging/log4j/core/config/ConfigurationScheduler.java | 9 +++------ .../org/apache/logging/log4j/core/config/Configurator.java | 4 ++-- src/site/xdoc/manual/configuration.xml.vm | 4 ++-- 4 files changed, 9 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/527b125c/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 9797cc6..dda319b 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 @@ -316,8 +316,8 @@ public class LoggerContext extends AbstractLifeCycle * Log4j can start threads to perform certain actions like file rollovers, calling this method with a positive timeout will * block until the rollover thread is done. * - * @param timeout the maximum time to wait, or 0 which mean that each apppender uses its default timeout, and wait for - * background tasks for one second + * @param timeout the maximum time to wait, or 0 which mean that each apppender uses its default timeout, and don't wait for background + tasks * @param timeUnit * the time unit of the timeout argument * @return {@code true} if the logger context terminated and {@code false} if the timeout elapsed before http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/527b125c/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java index 4c5b628..4839e75 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationScheduler.java @@ -17,6 +17,7 @@ package org.apache.logging.log4j.core.config; import java.util.Date; +import java.util.List; import java.util.Queue; import java.util.concurrent.Callable; import java.util.concurrent.ScheduledExecutorService; @@ -38,7 +39,6 @@ public class ConfigurationScheduler extends AbstractLifeCycle { private static final Logger LOGGER = StatusLogger.getLogger(); private static final String SIMPLE_NAME = "Log4j2 " + ConfigurationScheduler.class.getSimpleName(); private static final int MAX_SCHEDULED_ITEMS = 5; - private static final long DEFAULT_SHUTDOWN_TIMEOUT_MILLIS = 1000; private ScheduledExecutorService executorService; private int scheduledItems = 0; @@ -52,17 +52,14 @@ public class ConfigurationScheduler extends AbstractLifeCycle { public boolean stop(final long timeout, final TimeUnit timeUnit) { setStopping(); if (isExecutorServiceSet()) { - long timeoutToUse = timeout > 0 ? timeout : DEFAULT_SHUTDOWN_TIMEOUT_MILLIS; - TimeUnit timeUnitToUse = timeout > 0 ? timeUnit : TimeUnit.MILLISECONDS; - LOGGER.debug("{} shutting down threads in {}", SIMPLE_NAME, getExecutorService()); executorService.shutdown(); try { - executorService.awaitTermination(timeoutToUse, timeUnitToUse); + executorService.awaitTermination(timeout, timeUnit); } catch (final InterruptedException ie) { executorService.shutdownNow(); try { - executorService.awaitTermination(timeoutToUse, timeUnitToUse); + executorService.awaitTermination(timeout, timeUnit); } catch (final InterruptedException inner) { LOGGER.warn("ConfigurationScheduler stopped but some scheduled services may not have completed."); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/527b125c/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java index 63d8a81..28dd85f 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java @@ -331,8 +331,8 @@ public final class Configurator { /** * Shuts down the given logger context. This request does not wait for Log4j tasks to complete. * <p> - * Log4j starts threads to perform certain actions like file rollovers; calling this method will wait up to one second - * until the rollover thread is done. When this method returns, these tasks' status are undefined, the tasks may be done or + * Log4j starts threads to perform certain actions like file rollovers; calling this method will not wait until the + * rollover thread is done. When this method returns, these tasks' status are undefined, the tasks may be done or * not. * </p> * http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/527b125c/src/site/xdoc/manual/configuration.xml.vm ---------------------------------------------------------------------- diff --git a/src/site/xdoc/manual/configuration.xml.vm b/src/site/xdoc/manual/configuration.xml.vm index 35b43ee..aa86099 100644 --- a/src/site/xdoc/manual/configuration.xml.vm +++ b/src/site/xdoc/manual/configuration.xml.vm @@ -410,8 +410,8 @@ public class Bar { <tr> <td>shutdownTimeout</td> <td>Specifies how many milliseconds appenders and background tasks will get to shutdown when the JVM shuts - down. Default is zero which mean that each appender uses its default timeout, and wait for background - tasks for one second. Not all appenders will honor this, it is a hint and not an absolute guarantee that the shutdown + down. Default is zero which mean that each appender uses its default timeout, and don't wait for background + tasks. Not all appenders will honor this, it is a hint and not an absolute guarantee that the shutdown procedure will not take longer. Setting this too low increase the risk of losing outstanding log events not yet written to the final destination. See <a class="javadoc" href="../log4j-core/target/site/apidocs/org/apache/logging/log4j/core/LoggerContext.html${esc.hash}stop(long, java.util.concurrent.TimeUnit)">LoggerContext.stop(long,
