You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mg...@apache.org on 2020/08/27 12:03:13 UTC

[tomcat] branch 8.5.x updated (01945af -> a1f53c3)

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

mgrigorov pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from 01945af  Do not load stacktrace for StopPooledThreadException
     new fab97c7  Change forcedRemainingCapacity from Integer to int
     new a1f53c3  Clarify where wildcards are allowed in Host and Alias directives

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/tomcat/util/threads/TaskQueue.java         | 14 +++++++++-----
 .../org/apache/tomcat/util/threads/ThreadPoolExecutor.java |  4 ++--
 webapps/docs/config/host.xml                               | 13 +++++--------
 3 files changed, 16 insertions(+), 15 deletions(-)


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


[tomcat] 02/02: Clarify where wildcards are allowed in Host and Alias directives

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a1f53c366ded63bb1d57adc8000b082a4b70d767
Author: Tom Chiverton <to...@users.noreply.github.com>
AuthorDate: Wed Aug 26 16:41:52 2020 +0100

    Clarify where wildcards are allowed in Host and Alias directives
    
    (cherry picked from commit ae88ac2ee9a69b075696769c6b7ec61b7ba1d8a6)
---
 webapps/docs/config/host.xml | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/webapps/docs/config/host.xml b/webapps/docs/config/host.xml
index d2e8f14..3d97fd9 100644
--- a/webapps/docs/config/host.xml
+++ b/webapps/docs/config/host.xml
@@ -192,10 +192,8 @@
         have a name that matches the <code>defaultHost</code> setting for that
         Engine.  See <a href="#Host_Name_Aliases">Host Name Aliases</a> for
         information on how to assign more than one network name to the same
-        virtual host. If the name takes the form of <code>*.domainname</code>
-        (e.g. <code>*.apache.org</code>) then it will be treated as a match for
-        any host in that domain unless a host that has an exactly matching name
-        is found.</p>
+        virtual host. The name can not contain a wildcard, this is only
+        valid in an Alias.</p>
       </attribute>
 
       <attribute name="startStopThreads" required="false">
@@ -491,10 +489,9 @@
     involved must be registered in your DNS server to resolve to the
     same computer that is running this instance of Catalina.</p>
 
-    <p>Aliases may also use the wildcard form (<code>*.domainname</code>)
-       permitted for the <strong>name</strong> attribute of a
-       <strong>Host</strong>.</p>
-
+    <p>Aliases may also use the wildcard form (<code>*.domainname</code>), 
+    unlike for the <strong>name</strong> attribute of a <strong>Host</strong>.
+    </p>
   </subsection>
 
 


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


[tomcat] 01/02: Change forcedRemainingCapacity from Integer to int

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit fab97c761b07e02fd79b5a932e4d7f4a38f1a084
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Tue Aug 25 14:36:23 2020 +0300

    Change forcedRemainingCapacity from Integer to int
    
    No need to create object (or use Integer cache) and cast it to primitive int.
    'forcedRemainingCapacity' can do its job with a primitive int, since Queue's capacity cannot be negative value
---
 java/org/apache/tomcat/util/threads/TaskQueue.java         | 14 +++++++++-----
 .../org/apache/tomcat/util/threads/ThreadPoolExecutor.java |  4 ++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/tomcat/util/threads/TaskQueue.java b/java/org/apache/tomcat/util/threads/TaskQueue.java
index 600fe5b..cdd0bc2 100644
--- a/java/org/apache/tomcat/util/threads/TaskQueue.java
+++ b/java/org/apache/tomcat/util/threads/TaskQueue.java
@@ -35,8 +35,8 @@ public class TaskQueue extends LinkedBlockingQueue<Runnable> {
     private transient volatile ThreadPoolExecutor parent = null;
 
     // No need to be volatile. This is written and read in a single thread
-    // (when stopping a context and firing the  listeners)
-    private Integer forcedRemainingCapacity = null;
+    // (when stopping a context and firing the listeners)
+    private int forcedRemainingCapacity = -1;
 
     public TaskQueue() {
         super();
@@ -105,18 +105,22 @@ public class TaskQueue extends LinkedBlockingQueue<Runnable> {
 
     @Override
     public int remainingCapacity() {
-        if (forcedRemainingCapacity != null) {
+        if (forcedRemainingCapacity > DEFAULT_FORCED_REMAINING_CAPACITY) {
             // ThreadPoolExecutor.setCorePoolSize checks that
             // remainingCapacity==0 to allow to interrupt idle threads
             // I don't see why, but this hack allows to conform to this
             // "requirement"
-            return forcedRemainingCapacity.intValue();
+            return forcedRemainingCapacity;
         }
         return super.remainingCapacity();
     }
 
-    public void setForcedRemainingCapacity(Integer forcedRemainingCapacity) {
+    public void setForcedRemainingCapacity(int forcedRemainingCapacity) {
         this.forcedRemainingCapacity = forcedRemainingCapacity;
     }
 
+    void resetForcedRemainingCapacity() {
+        this.forcedRemainingCapacity = DEFAULT_FORCED_REMAINING_CAPACITY;
+    }
+
 }
diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
index 74ec4a0..42db3df 100644
--- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
+++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
@@ -197,7 +197,7 @@ public class ThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor
             // checks that queue.remainingCapacity()==0. I did not understand
             // why, but to get the intended effect of waking up idle threads, I
             // temporarily fake this condition.
-            taskQueue.setForcedRemainingCapacity(Integer.valueOf(0));
+            taskQueue.setForcedRemainingCapacity(0);
         }
 
         // setCorePoolSize(0) wakes idle threads
@@ -209,7 +209,7 @@ public class ThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor
 
         if (taskQueue != null) {
             // ok, restore the state of the queue and pool
-            taskQueue.setForcedRemainingCapacity(null);
+            taskQueue.resetForcedRemainingCapacity();
         }
         this.setCorePoolSize(savedCorePoolSize);
     }


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