review comments
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
6ed64e1e65
commit
1d5d8071ba
|
@ -55,7 +55,8 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
|
|
||||||
public void recycle()
|
public void recycle()
|
||||||
{
|
{
|
||||||
reopen();
|
if (LOG.isDebugEnabled())
|
||||||
|
LOG.debug("recycle {}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reopen()
|
public void reopen()
|
||||||
|
@ -63,7 +64,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
try (AutoLock lock = _contentProducer.lock())
|
try (AutoLock lock = _contentProducer.lock())
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("recycle/reopen {}", this);
|
LOG.debug("reopen {}", this);
|
||||||
_blockingContentProducer.recycle();
|
_blockingContentProducer.recycle();
|
||||||
_contentProducer = _blockingContentProducer;
|
_contentProducer = _blockingContentProducer;
|
||||||
_consumedEof = false;
|
_consumedEof = false;
|
||||||
|
|
|
@ -56,12 +56,13 @@ public class RequestReaderTest extends AbstractTest<TransportScenario>
|
||||||
if (b == -1)
|
if (b == -1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Paranoid check.
|
||||||
|
assertThat(br.read(), is(-1));
|
||||||
baseRequest.setHandled(true);
|
baseRequest.setHandled(true);
|
||||||
}
|
}
|
||||||
}, client -> {});
|
}, client -> {});
|
||||||
|
|
||||||
ContentResponse response1 = scenario.client.newRequest("localhost", scenario.server.getURI().getPort())
|
ContentResponse response1 = scenario.client.newRequest(scenario.newURI())
|
||||||
.scheme(scenario.server.getURI().getScheme())
|
|
||||||
.method("POST")
|
.method("POST")
|
||||||
.timeout(5, TimeUnit.SECONDS)
|
.timeout(5, TimeUnit.SECONDS)
|
||||||
.body(new BytesRequestContent(new byte[512]))
|
.body(new BytesRequestContent(new byte[512]))
|
||||||
|
@ -69,8 +70,7 @@ public class RequestReaderTest extends AbstractTest<TransportScenario>
|
||||||
assertThat(response1.getStatus(), is(HttpStatus.OK_200));
|
assertThat(response1.getStatus(), is(HttpStatus.OK_200));
|
||||||
|
|
||||||
// Send a 2nd request to make sure recycling works.
|
// Send a 2nd request to make sure recycling works.
|
||||||
ContentResponse response2 = scenario.client.newRequest("localhost", scenario.server.getURI().getPort())
|
ContentResponse response2 = scenario.client.newRequest(scenario.newURI())
|
||||||
.scheme(scenario.server.getURI().getScheme())
|
|
||||||
.method("POST")
|
.method("POST")
|
||||||
.timeout(5, TimeUnit.SECONDS)
|
.timeout(5, TimeUnit.SECONDS)
|
||||||
.body(new BytesRequestContent(new byte[512]))
|
.body(new BytesRequestContent(new byte[512]))
|
||||||
|
|
Loading…
Reference in New Issue