RFR: 8332535: Mark java/nio/channels/DatagramChannel/Loopback.java as intermittent [v2]
SendaoYan
syan at openjdk.org
Wed Jun 26 02:54:36 UTC 2024
On Tue, 25 Jun 2024 17:23:20 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Do you mean like this:
>>
>> - ByteBuffer src = ByteBuffer.wrap("hello".getBytes("UTF-8"));
>> + String str = "hello integer" + new Random().nextInt(10000);
>> + ByteBuffer src = ByteBuffer.wrap(str.getBytes("UTF-8"));
>>
>> And I don't known how to discard meaasge doesn't match what we expect.
>
> Yes - something like that. System.nanoTime() could work too.
> By discard, I mean compare the content of `dst` with what was put in `src` - and if it doesn't match, clear `dst` and continue to go back to select() without even looking at the sender port. You may want to adjust the timeout you pass to select the second time around.
> Rationale is: if the payloads do not match then we're just receiving some stray packet probably sent by another (test?) process, and we should ignore it. Only if the port match and the content match should we consider it a failure.
Seems that it doesn't need to adjust the timeout to select the second time around.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19314#discussion_r1653854174
More information about the nio-dev
mailing list