On 12/03/2015 13:52, Christopher Schultz wrote:
> Mark,
> 
> On 3/11/15 5:06 PM, ma...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to