RFR[8243488]: 'Add tests for set/get SendBufferSize and getReceiveBufferSize in DatagramSocket'

Daniel Fuchs daniel.fuchs at oracle.com
Thu Apr 30 11:15:02 UTC 2020


Hi Alan,

On 30/04/2020 11:48, Alan Bateman wrote:
>>
>> http://cr.openjdk.java.net/~pconcannon/8243488/webrevs/webrev.02/
>>
> Another approach would be replace DSF with a simple supplier like this:
> 
>      @FunctionalInterface
>      interface DatagramSocketSupplier {
>          DatagramSocket get() throws IOException;
>      }
> 

I don't understand your comment. Maybe I'm missing something?
That's exactly what DSF is isn't it?
We just choose to name the method 'open' instead of 'get'.
And the static `DSF of(DSF)` method is simply there to provide
a type witness and avoid a cast (you get a compilation error
otherwise).

In other words - we could possibly replace
   { "..", DSF.of(() -> new DatagramSocket()) }
with
   { "..", (DSF)() -> new DatagramSocket() }
but
   { "..", () -> new DatagramSocket() }
will never compile.

best regards,

-- daniel


More information about the net-dev mailing list