Ok thanks… update to the java docs sounds good to me. I was just suprised by 
the behaviour :)

> On 11. Apr 2019, at 17:12, Michael McMahon <michael.x.mcma...@oracle.com> 
> wrote:
> 
> Norman
> 
> The specification on what happens to all socket types was updated many years 
> ago
> in bug id 6505016, but it looks like ServerSocket::isBound was missed from 
> that effort.
> I think we should probably update the spec to reflect current behavior and be 
> consistent
> with the change above. There will be some small spec updates to ServerSocket 
> coming
> which originated from the SocketImpl replacement work that Alan mentioned 
> recently
> and I think we can include this small change probably with one of those.
> 
> Michael.
> 
> On 11/04/2019, 13:40, Norman Maurer wrote:
>> 
>> Hi there,
>> 
>> While working on netty I just noticed that a ServerSocket will keep return 
>> true when isBound() is called even after it was closed. Is this by design? I 
>> was bit surprised by this honestly as after the socket is closed there is no 
>> way it will accept any more connections.
>> 
>> If this is by design should we at least update the java docs ?
>> 
>> https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/ServerSocket.html#isBound()
>>  
>> <https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/ServerSocket.html#isBound%28%29>
>> 
>> In contrast for DatagramSocket it is directly called out:
>> 
>> https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/DatagramSocket.html#isBound()
>>  
>> <https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/DatagramSocket.html#isBound%28%29>
>> 
>> So I wonder if it was mainly done the same way for a ServerSocket to be more 
>> consistent here or if it is just an oversight.
>> 
>> This code shows the behaviour. 
>> 
>> ServerSocket socket = new ServerSocket(0);
>> 
>> socket.close();
>> if (socket.isBound()) {
>>     throw new AssertionError();
>> }
>> 
>> 
>> 
>> Thanks,
>> Norman
>> 

Reply via email to