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 2015/03/11 22:06:54 UTC

svn commit: r1666013 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Author: markt
Date: Wed Mar 11 21:06:53 2015
New Revision: 1666013

URL: http://svn.apache.org/r1666013
Log:
Add a placeholder for the descriptor merging that is going to be necessary for OSX and BSD.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1666013&r1=1666012&r2=1666013&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar 11 21:06:53 2015
@@ -1759,6 +1759,7 @@ public class AprEndpoint extends Abstrac
                             nextPollerTime += pollerTime;
                         }
                         if (rv > 0) {
+                            rv = mergeDescriptors(desc, rv);
                             pollerSpace[i] += rv;
                             connectionCount.addAndGet(-rv);
                             for (int n = 0; n < rv; n++) {
@@ -1923,6 +1924,21 @@ public class AprEndpoint extends Abstrac
                 this.notifyAll();
             }
         }
+
+
+        private int mergeDescriptors(long[] desc, int startCount) {
+            if (OS.IS_BSD || OS.IS_MACOSX) {
+                // TODO Need to actually implement merging of the descriptors here.
+                //      I'm currently thinking quicksort followed by running
+                //      through the sorted list to merge the events.
+                return startCount;
+            } else {
+                // Other OS's do not (as far as it is known) return multiple
+                // entries for the same socket when the socket is registered for
+                // multiple events.
+                return startCount;
+            }
+        }
     }
 
 



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


Re: svn commit: r1666013 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Posted by Mark Thomas <ma...@apache.org>.
On 12/03/2015 13:52, Christopher Schultz wrote:
> Mark,
> 
> On 3/11/15 5:06 PM, markt@apache.org wrote:
>> Author: markt
>> Date: Wed Mar 11 21:06:53 2015
>> New Revision: 1666013
>>
>> URL: http://svn.apache.org/r1666013
>> Log:
>> Add a placeholder for the descriptor merging that is going to be necessary for OSX and BSD.
>>
>> Modified:
>>     tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
>>
>> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
>> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1666013&r1=1666012&r2=1666013&view=diff
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
>> +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar 11 21:06:53 2015
>> @@ -1759,6 +1759,7 @@ public class AprEndpoint extends Abstrac
>>                              nextPollerTime += pollerTime;
>>                          }
>>                          if (rv > 0) {
>> +                            rv = mergeDescriptors(desc, rv);
>>                              pollerSpace[i] += rv;
>>                              connectionCount.addAndGet(-rv);
>>                              for (int n = 0; n < rv; n++) {
>> @@ -1923,6 +1924,21 @@ public class AprEndpoint extends Abstrac
>>                  this.notifyAll();
>>              }
>>          }
>> +
>> +
>> +        private int mergeDescriptors(long[] desc, int startCount) {
>> +            if (OS.IS_BSD || OS.IS_MACOSX) {
>> +                // TODO Need to actually implement merging of the descriptors here.
>> +                //      I'm currently thinking quicksort followed by running
>> +                //      through the sorted list to merge the events.
>> +                return startCount;
> 
> How many events are you expecting to have to handle, how many do you
> expect to merge, and how often do you expect to do any actual work?

No idea to all of the above. That is part of the problem.

> QuickSort is great if your data are completely unordered and you intend
> to actually order them. In this case, though, the order of the data is
> only a convenience to find matches and not the end goal.
> 
> There may be better ways to find matches than sorting and then
> performing a linear search for matches.

Quote possibly. In the end I went for easy to follow code that should be
good enough. If someone has a use case where this is not the case, we
can deal with it then.

Mark

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


Re: svn commit: r1666013 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,

On 3/11/15 5:06 PM, markt@apache.org wrote:
> Author: markt
> Date: Wed Mar 11 21:06:53 2015
> New Revision: 1666013
> 
> URL: http://svn.apache.org/r1666013
> Log:
> Add a placeholder for the descriptor merging that is going to be necessary for OSX and BSD.
> 
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> 
> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1666013&r1=1666012&r2=1666013&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar 11 21:06:53 2015
> @@ -1759,6 +1759,7 @@ public class AprEndpoint extends Abstrac
>                              nextPollerTime += pollerTime;
>                          }
>                          if (rv > 0) {
> +                            rv = mergeDescriptors(desc, rv);
>                              pollerSpace[i] += rv;
>                              connectionCount.addAndGet(-rv);
>                              for (int n = 0; n < rv; n++) {
> @@ -1923,6 +1924,21 @@ public class AprEndpoint extends Abstrac
>                  this.notifyAll();
>              }
>          }
> +
> +
> +        private int mergeDescriptors(long[] desc, int startCount) {
> +            if (OS.IS_BSD || OS.IS_MACOSX) {
> +                // TODO Need to actually implement merging of the descriptors here.
> +                //      I'm currently thinking quicksort followed by running
> +                //      through the sorted list to merge the events.
> +                return startCount;

How many events are you expecting to have to handle, how many do you
expect to merge, and how often do you expect to do any actual work?
QuickSort is great if your data are completely unordered and you intend
to actually order them. In this case, though, the order of the data is
only a convenience to find matches and not the end goal.

There may be better ways to find matches than sorting and then
performing a linear search for matches.

-chris