On Thu, 30 Apr 2026 11:25:29 GMT, Jaikiran Pai <[email protected]> wrote:

> Can I please get a review of this doc-only change which updates the 
> specification of `Socket.isInputShutdown()` and `Socket.isOutputShutdown()` 
> to clarify how it behaves when the `Socket` has been closed?
> 
> This addresses https://bugs.openjdk.org/browse/JDK-8310138. The commit in 
> this PR merely specifies the current implementation. I'll create a CSR 
> shortly.
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

> For me it would be more surprising if this method returned false after 
> close() if shutdownInput() hadn't be called before close().

That's what the implementation does currently - it returns `false()` from 
`isInputShutdown()` if `shutdownInput()` hadn't been called irrespective of 
whether or not `close()` was called:

jshell> var s = new Socket()
s ==> Socket[unconnected]

jshell> s.close()

jshell> s.isInputShutdown()
$12 ==> false

jshell> s.isOutputShutdown()
$13 ==> false

jshell> s.isClosed()
$14 ==> true



> I would naively expect isInputShutdown() to return true after close() always, 
> regardless of whether shutdownInput() had been called before close(), or not.

The "read-half", "write-half" and "closed" states are managed independent of 
each other in the Socket implementation.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/31000#issuecomment-4352929792

Reply via email to