RFR: 8281511: java/net/ipv6tests/UdpTest.java fails with checkTime failed [v5]
    Daniel Fuchs 
    dfuchs at openjdk.org
       
    Tue Mar  4 14:55:07 UTC 2025
    
    
  
On Tue, 4 Mar 2025 12:18:10 GMT, serhiysachkov <duke at openjdk.org> wrote:
>> switching to nanoTime as suggested in ticket comments
>
> serhiysachkov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8281511: update check timeout logic to take into account lower bound as mentioned in review discussion
We do not need the nano-second precision. Using millis makes for more readable logs.
test/jdk/java/net/ipv6tests/UdpTest.java line 149:
> 147:         }
> 148:         final long expectedTimeInNanos = TimeUnit.SECONDS.toNanos(4);
> 149:         checkIfTimeOut(System.nanoTime() - t1, expectedTimeInNanos);
Suggestion:
        final long expectedTime = TimeUnit.SECONDS.toMillis(4);
        checkIfTimeOut(TimeUnit.NANOS.toMillis(System.nanoTime() - t1), expectedTime);
test/jdk/java/net/ipv6tests/UdpTest.java line 162:
> 160:         } catch (SocketTimeoutException e) {
> 161:         }
> 162:         checkIfTimeOut(System.nanoTime() - t1, expectedTimeInNanos);
Suggestion:
        checkIfTimeOut(TimeUnit.NANOS.toMillis(System.nanoTime() - t1), expectedTime);
test/jdk/java/net/ipv6tests/UdpTest.java line 182:
> 180:         s1.receive (new DatagramPacket (new byte [128], 128));
> 181:         final long startTimeInNanos = TimeUnit.SECONDS.toNanos(2);
> 182:         checkIfTimeOut(System.nanoTime() - t1, startTimeInNanos);
Suggestion:
        final long startTime = TimeUnit.SECONDS.toMillis(2);
        checkIfTimeOut(TimeUnit.NANOS.toMillis(System.nanoTime() - t1), startTime);
-------------
PR Review: https://git.openjdk.org/jdk/pull/23840#pullrequestreview-2657858917
PR Review Comment: https://git.openjdk.org/jdk/pull/23840#discussion_r1979607848
PR Review Comment: https://git.openjdk.org/jdk/pull/23840#discussion_r1979612362
PR Review Comment: https://git.openjdk.org/jdk/pull/23840#discussion_r1979619337
    
    
More information about the net-dev
mailing list