diff --git a/akka-actor/src/main/scala/akka/io/Tcp.scala b/akka-actor/src/main/scala/akka/io/Tcp.scala index aee19ac24b..b1a9bb62f2 100644 --- a/akka-actor/src/main/scala/akka/io/Tcp.scala +++ b/akka-actor/src/main/scala/akka/io/Tcp.scala @@ -217,6 +217,7 @@ object TcpMessage { backlog: Int): Command = Bind(handler, endpoint, backlog, Nil) def register(handler: ActorRef): Command = Register(handler) + def register(handler: ActorRef, keepOpenOnPeerClosed: Boolean): Command = Register(handler, keepOpenOnPeerClosed) def unbind: Command = Unbind def close: Command = Close diff --git a/akka-docs/rst/java/io.rst b/akka-docs/rst/java/io.rst index 54d47804dc..68f2a82ea1 100644 --- a/akka-docs/rst/java/io.rst +++ b/akka-docs/rst/java/io.rst @@ -442,7 +442,10 @@ successful, the listener will be notified with ``ConfirmedClosed``. ``Abort`` will immediately terminate the connection by sending a ``RST`` message to the remote endpoint. Pending writes will be not flushed. If the close is successful, the listener will be notified with ``Aborted``. -``PeerClosed`` will be sent to the listener if the connection has been closed by the remote endpoint. +``PeerClosed`` will be sent to the listener if the connection has been closed by the remote endpoint. Per default, the +connection will then automatically be closed from this endpoint as well. To support half-closed connections set the +``keepOpenOnPeerClosed`` member of the ``Register`` message to ``true`` in which case the connection stays open until +it receives one of the above close commands. ``ErrorClosed`` will be sent to the listener whenever an error happened that forced the connection to be closed.