Skip to content

Commit

Permalink
Reactor netty connection pooling (#7130)
Browse files Browse the repository at this point in the history
* Added some logging around open connections

* Removed extra logging

* Removed dispose calls to re-use connection

* Removed empty close method
  • Loading branch information
kushagraThapar authored Jan 6, 2020
1 parent ebd48c1 commit 51c4efc
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,31 +172,22 @@ public HttpHeaders headers() {

@Override
public Flux<ByteBuf> body() {
return bodyIntern().doFinally(s -> this.close());
return bodyIntern();
}

@Override
public Mono<byte[]> bodyAsByteArray() {
return bodyIntern().aggregate().asByteArray().doFinally(s -> this.close());
return bodyIntern().aggregate().asByteArray();
}

@Override
public Mono<String> bodyAsString() {
return bodyIntern().aggregate().asString().doFinally(s -> this.close());
return bodyIntern().aggregate().asString();
}

@Override
public Mono<String> 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() {
Expand Down

0 comments on commit 51c4efc

Please sign in to comment.