You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/11/20 13:25:46 UTC

[tomcat] 01/05: Polish. Align with 8.5.x/9.0.x

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

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

View the commit online:
https://github.com/apache/tomcat/commit/34a0f1156ad88668bbbce83fadc42a69367dfb4f

commit 34a0f1156ad88668bbbce83fadc42a69367dfb4f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Nov 19 16:18:08 2019 +0000

    Polish. Align with 8.5.x/9.0.x
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 34 ++++++++++++++++--------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 24014d4..a31430d 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.tomcat.util.net;
 
 import java.security.AccessController;
@@ -69,10 +68,8 @@ import org.apache.tomcat.util.security.PrivilegedSetTccl;
  */
 public class AprEndpoint extends AbstractEndpoint<Long> {
 
-
     // -------------------------------------------------------------- Constants
 
-
     private static final Log log = LogFactory.getLog(AprEndpoint.class);
 
     // Lazy init as we need the AprLifecycleListener to have loaded the
@@ -102,6 +99,7 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
 
 
     // ----------------------------------------------------------------- Fields
+
     /**
      * Root APR memory pool.
      */
@@ -424,7 +422,9 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
     // --------------------------------------------------------- Public Methods
 
     /**
-     * Number of keepalive sockets.
+     * Obtain the number of kept alive sockets.
+     *
+     * @return The number of open sockets currently managed by the Poller
      */
     public int getKeepAliveCount() {
         if (poller == null) {
@@ -436,7 +436,9 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
 
 
     /**
-     * Number of sendfile sockets.
+     * Obtain the number of sendfile sockets.
+     *
+     * @return The number of sockets currently managed by the Sendfile poller.
      */
     public int getSendfileCount() {
         if (sendfile == null) {
@@ -473,8 +475,9 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
         int family = Socket.APR_INET;
         if (Library.APR_HAVE_IPV6) {
             if (addressStr == null) {
-                if (!OS.IS_BSD && !OS.IS_WIN32 && !OS.IS_WIN64)
+                if (!OS.IS_BSD && !OS.IS_WIN32 && !OS.IS_WIN64) {
                     family = Socket.APR_UNSPEC;
+                }
             } else if (addressStr.indexOf(':') >= 0) {
                 family = Socket.APR_UNSPEC;
             }
@@ -891,6 +894,10 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
 
     /**
      * Allocate a new poller of the specified size.
+     * @param size The size
+     * @param pool The pool from which the poller will be allocated
+     * @param timeout The timeout
+     * @return the poller pointer
      */
     protected long allocatePoller(int size, long pool, int timeout) {
         try {
@@ -909,6 +916,10 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
     /**
      * Process given socket. This is called when the socket has been
      * accepted.
+     * @param socket The socket
+     * @return <code>true</code> if the socket was correctly configured
+     *  and processing may continue, <code>false</code> if the socket needs to be
+     *  close immediately
      */
     protected boolean processSocketWithOptions(long socket) {
         try {
@@ -1065,7 +1076,6 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
         }
     }
 
-
     @Override
     protected Log getLog() {
         return log;
@@ -1278,6 +1288,8 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
         /**
          * Removes the specified socket from the poller.
          *
+         * @param socket The socket to remove
+         *
          * @return The configured timeout for the socket or zero if the socket
          *         was not in the list of socket timeouts
          */
@@ -1715,6 +1727,7 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
             return (rv == Status.APR_SUCCESS);
         }
 
+
         /**
          * Timeout checks.
          */
@@ -1765,8 +1778,9 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
         }
 
         /**
-         * The background thread that listens for incoming TCP/IP connections
-         * and hands them off to an appropriate processor.
+         * The background thread that adds sockets to the Poller, checks the
+         * poller for triggered events and hands the associated socket off to an
+         * appropriate processor as events occur.
          */
         @Override
         public void run() {
@@ -2125,7 +2139,6 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
 
     // ----------------------------------------------- SendfileData Inner Class
 
-
     /**
      * SendfileData class.
      */
@@ -2148,7 +2161,6 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
 
     // --------------------------------------------------- Sendfile Inner Class
 
-
     public class Sendfile implements Runnable {
 
         protected long sendfilePollset = 0;


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