Arne Vajh?j schrieb:
If what you want is not in the docs, then it
is not broken as you claim.
Its simply broken because of the following
chain of reasoning.
- InputStream/OutputStream are supposed
to be blocking IO in contrast to NIO.
- When a shutdown sequence is initiated
no InputStream/OutputStream is killed
they remain blocking in case they were
already blocking.
so that the shutdown hooks can gracefully
terminate their service. For example
a goodbye sequence with a web server, etc..
- SIGINT when available, by default
initiates a shutdown sequence.
- The Windows behaviour for CONIN$ violates
the above, since during SIGINT the
CONIN$ becomes non-blocking in that
it returns EOF.
So this is what is broken here. It contaminates
any sensible use of shutdown hooks as described
here in the case of Windows:
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29
Well that doc does not state anything about streams remain blocked.
It is just something you have invented.
because the behavior is not specified.
how it actually behave.
is not well defined.