From 5f58c54bdbede936a26322171908faf05ddf133b Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Tue, 9 Apr 2013 11:07:53 +0200 Subject: [PATCH] add Tcp.register overload with `keepOpenOnPeerClosed` parameter for Java usage --- akka-actor/src/main/scala/akka/io/Tcp.scala | 1 + akka-docs/rst/java/io.rst | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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.