Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
  • Loading branch information
lorban committed May 19, 2021
1 parent 6ed64e1 commit 1d5d807
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Expand Up @@ -55,15 +55,16 @@ public HttpInput(HttpChannelState state)

public void recycle()
{
reopen();
if (LOG.isDebugEnabled())
LOG.debug("recycle {}", this);
}

public void reopen()
{
try (AutoLock lock = _contentProducer.lock())
{
if (LOG.isDebugEnabled())
LOG.debug("recycle/reopen {}", this);
LOG.debug("reopen {}", this);
_blockingContentProducer.recycle();
_contentProducer = _blockingContentProducer;
_consumedEof = false;
Expand Down
Expand Up @@ -56,21 +56,21 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
if (b == -1)
break;
}
// Paranoid check.
assertThat(br.read(), is(-1));
baseRequest.setHandled(true);
}
}, client -> {});

ContentResponse response1 = scenario.client.newRequest("localhost", scenario.server.getURI().getPort())
.scheme(scenario.server.getURI().getScheme())
ContentResponse response1 = scenario.client.newRequest(scenario.newURI())
.method("POST")
.timeout(5, TimeUnit.SECONDS)
.body(new BytesRequestContent(new byte[512]))
.send();
assertThat(response1.getStatus(), is(HttpStatus.OK_200));

// Send a 2nd request to make sure recycling works.
ContentResponse response2 = scenario.client.newRequest("localhost", scenario.server.getURI().getPort())
.scheme(scenario.server.getURI().getScheme())
ContentResponse response2 = scenario.client.newRequest(scenario.newURI())
.method("POST")
.timeout(5, TimeUnit.SECONDS)
.body(new BytesRequestContent(new byte[512]))
Expand Down

0 comments on commit 1d5d807

Please sign in to comment.