Skip to content

Commit

Permalink
KAFKA-14908: Set setReuseAddress on the kafka server socket
Browse files Browse the repository at this point in the history
Aids use-cases where kafka is started/stopped on the same port,  such as embedded testing.

Signed-off-by: kwall <kwall@apache.org>
  • Loading branch information
k-wall committed Apr 18, 2023
1 parent 454b721 commit 55313ce
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/src/main/scala/kafka/network/SocketServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ private[kafka] abstract class Acceptor(val socketServer: SocketServer,
new InetSocketAddress(host, port)
val serverChannel = ServerSocketChannel.open()
serverChannel.configureBlocking(false)
serverChannel.socket().setReuseAddress(true);
if (recvBufferSize != Selectable.USE_DEFAULT_BUFFER_SIZE)
serverChannel.socket().setReceiveBufferSize(recvBufferSize)

Expand Down

0 comments on commit 55313ce

Please sign in to comment.