From 5efdc097cba5884932438f38bc10db6bf8510ff9 Mon Sep 17 00:00:00 2001 From: Mohammad Derakhshani Date: Mon, 6 Jan 2020 10:17:55 -0800 Subject: [PATCH] ported fix from v3 --- .../implementation/http/ReactorNettyClient.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) 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() {