This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 1e4955af7cfd073eece5836ded05d719c6c6c4cb
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Nov 25 14:12:45 2021 +0000

    Refactor AsyncFileHandler to make use of system property unnecessary
    
    System property: org.apache.juli.AsyncLoggerPollInterval
---
 conf/catalina.policy                       |  1 -
 java/org/apache/juli/AsyncFileHandler.java | 12 ++----------
 webapps/docs/changelog.xml                 |  5 +++++
 webapps/docs/config/systemprops.xml        |  7 -------
 4 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/conf/catalina.policy b/conf/catalina.policy
index 91b7c83..7aab95d 100644
--- a/conf/catalina.policy
+++ b/conf/catalina.policy
@@ -89,7 +89,6 @@ grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
 
         permission java.util.PropertyPermission 
"java.util.logging.config.class", "read";
         permission java.util.PropertyPermission 
"java.util.logging.config.file", "read";
-        permission java.util.PropertyPermission 
"org.apache.juli.AsyncLoggerPollInterval", "read";
         permission java.util.PropertyPermission 
"org.apache.juli.AsyncMaxRecordCount", "read";
         permission java.util.PropertyPermission 
"org.apache.juli.AsyncOverflowDropType", "read";
         permission java.util.PropertyPermission 
"org.apache.juli.ClassLoaderLogManager.debug", "read";
diff --git a/java/org/apache/juli/AsyncFileHandler.java 
b/java/org/apache/juli/AsyncFileHandler.java
index 08a80ef..3613f7d 100644
--- a/java/org/apache/juli/AsyncFileHandler.java
+++ b/java/org/apache/juli/AsyncFileHandler.java
@@ -33,8 +33,6 @@ import java.util.logging.LogRecord;
  *    Default value: <code>1</code></li>
  *   <li><code>org.apache.juli.AsyncMaxRecordCount</code>
  *    Default value: <code>10000</code></li>
- *   <li><code>org.apache.juli.AsyncLoggerPollInterval</code>
- *    Default value: <code>1000</code></li>
  * </ul>
  *
  * <p>See the System Properties page in the configuration reference of 
Tomcat.</p>
@@ -48,7 +46,6 @@ public class AsyncFileHandler extends FileHandler {
 
     public static final int DEFAULT_OVERFLOW_DROP_TYPE = 1;
     public static final int DEFAULT_MAX_RECORDS        = 10000;
-    public static final int DEFAULT_LOGGER_SLEEP_TIME  = 1000;
 
     public static final int OVERFLOW_DROP_TYPE = Integer.parseInt(
             System.getProperty("org.apache.juli.AsyncOverflowDropType",
@@ -56,9 +53,6 @@ public class AsyncFileHandler extends FileHandler {
     public static final int MAX_RECORDS = Integer.parseInt(
             System.getProperty("org.apache.juli.AsyncMaxRecordCount",
                                Integer.toString(DEFAULT_MAX_RECORDS)));
-    public static final int LOGGER_SLEEP_TIME = Integer.parseInt(
-            System.getProperty("org.apache.juli.AsyncLoggerPollInterval",
-                               Integer.toString(DEFAULT_LOGGER_SLEEP_TIME)));
 
     protected static final LinkedBlockingDeque<LogEntry> queue =
             new LinkedBlockingDeque<>(MAX_RECORDS);
@@ -206,10 +200,8 @@ public class AsyncFileHandler extends FileHandler {
         public void run() {
             while (true) {
                 try {
-                    LogEntry entry = queue.poll(LOGGER_SLEEP_TIME, 
TimeUnit.MILLISECONDS);
-                    if (entry != null) {
-                        entry.flush();
-                    }
+                    LogEntry entry = queue.take();
+                    entry.flush();
                 } catch (InterruptedException x) {
                     // Ignore the attempt to interrupt the thread.
                 } catch (Exception x) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e7d1a91..cee5ef4 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -123,6 +123,11 @@
         Refactor the <code>AsyncFileHandler</code> to reduce the possibility of
         log messages being lost on shutdown. (markt)
       </fix>
+      <update>
+        Refactor the <code>AsyncFileHandler</code> to remove the need for the
+        <code>org.apache.juli.AsyncLoggerPollInterval</code>. If set, this
+        property now has no effect. (markt)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">
diff --git a/webapps/docs/config/systemprops.xml 
b/webapps/docs/config/systemprops.xml
index 349faab..ecf0b2f 100644
--- a/webapps/docs/config/systemprops.xml
+++ b/webapps/docs/config/systemprops.xml
@@ -200,13 +200,6 @@
       <p>The default value is <code>1</code> (drop the newest record in the 
queue).</p>
     </property>
 
-    <property name="org.apache.juli. AsyncLoggerPollInterval">
-      <p>The poll interval in milliseconds for the asynchronous logger thread.
-         If the log queue is empty, the async thread will issue a poll(poll 
interval)
-         in order to not wake up too often.</p>
-      <p>The default value is <code>1000</code> milliseconds.</p>
-    </property>
-
     <property name="org.apache.juli.logging. UserDataHelper.CONFIG">
       <p>The type of logging to use for errors generated by invalid input data.
          The options are: <code>DEBUG_ALL</code>, <code>INFO_THEN_DEBUG</code>,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to