review comments

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-05-19 15:53:49 +02:00
parent 6ed64e1e65
commit 1d5d8071ba
2 changed files with 7 additions and 6 deletions

View File

@ -55,7 +55,8 @@ public class HttpInput extends ServletInputStream implements Runnable
public void recycle()
{
reopen();
if (LOG.isDebugEnabled())
LOG.debug("recycle {}", this);
}
public void reopen()
@ -63,7 +64,7 @@ public class HttpInput extends ServletInputStream implements Runnable
try (AutoLock lock = _contentProducer.lock())
{
if (LOG.isDebugEnabled())
LOG.debug("recycle/reopen {}", this);
LOG.debug("reopen {}", this);
_blockingContentProducer.recycle();
_contentProducer = _blockingContentProducer;
_consumedEof = false;

View File

@ -56,12 +56,13 @@ public class RequestReaderTest extends AbstractTest<TransportScenario>
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]))
@ -69,8 +70,7 @@ public class RequestReaderTest extends AbstractTest<TransportScenario>
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]))