Menu

#26 Shutdown hooks to avoid TIME_WAIT

open
nobody
None
5
2004-12-03
2004-12-03
No

To avoid TIME_WAIT state for the server port, when a
server is shutdown prematurely, include a
Runtime.setShutDownHook(...), to tell remaining clients to
disconnect before the server closes the connections.

That would catch ctrl-C in unix (not SIGABORT)
as well as "end process" from the windows Task Manager. As
java's docs say, "Shutdown hooks run at a delicate time in
the life cycle of a virtual machine..." so we'll want to be
sure it's done cleanly.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB