RFR: 8151299 Http client SelectorManager overwriting read and write events

Michael McMahon michael.x.mcmahon at oracle.com
Wed Mar 9 10:26:44 UTC 2016


On 09/03/16 10:24, Michael McMahon wrote:
> On 08/03/16 14:10, Claes Redestad wrote:
>
>> Another oddity in the surrounding code is that 
>> System.currentTimeMillis() is always called, but only used when 
>> selector.select(timeval) == 0 - could this be moved into the if-block?
>>
>>  266 long now = System.currentTimeMillis();
>>  267                     int n = selector.select(timeval);
>>  268                     if (n == 0) {
>>  269                         signalTimeouts(now);
>>  270                         continue;
>>  271                     }
>>
>
> Yes, fair point. Will move that.

Sorry, just realised the reason for that now. The time needs to be recorded
before the select() call given that it can block for an indeterminate length
of time.

- Michael


More information about the net-dev mailing list