diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java index 2f3cf29c68c1..dd70ae57ea0e 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java @@ -164,31 +164,22 @@ public HttpHeaders headers() { @Override public Flux body() { - return bodyIntern().doFinally(s -> this.close()); + return bodyIntern(); } @Override public Mono bodyAsByteArray() { - return bodyIntern().aggregate().asByteArray().doFinally(s -> this.close()); + return bodyIntern().aggregate().asByteArray(); } @Override public Mono bodyAsString() { - return bodyIntern().aggregate().asString().doFinally(s -> this.close()); + return bodyIntern().aggregate().asString(); } @Override public Mono bodyAsString(Charset charset) { - return bodyIntern().aggregate().asString(charset).doFinally(s -> this.close()); - } - - @Override - public void close() { - if (reactorNettyConnection.channel().eventLoop().inEventLoop()) { - reactorNettyConnection.dispose(); - } else { - reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); - } + return bodyIntern().aggregate().asString(charset); } private ByteBufFlux bodyIntern() {