Bodo Junglas created HTTPASYNC-40:
-------------------------------------
Summary: Cannot suspend input when using AsyncByteConsumer
Key: HTTPASYNC-40
URL: https://issues.apache.org/jira/browse/HTTPASYNC-40
Project: HttpComponents HttpAsyncClient
Issue Type: Bug
Affects Versions: 4.0-beta3
Reporter: Bodo Junglas
Priority: Minor
When inheriting from org.apache.http.nio.client.methods.AsyncByteConsumer a
suspendInput on the iocrlt is unreliable. The core of the problem is this loop:
for (;;) {
int bytesRead = decoder.read(this.bbuf);
if (bytesRead <= 0) {
break;
}
this.bbuf.flip();
onByteReceived(this.bbuf, ioctrl);
this.bbuf.clear();
}
I.e. while there is anything to be read it is delivered to onByteReceived
non-stop (eat or die).
Unluckily a situation when a server delivers its data so fast that decoder.read
never returns 0 is usually also a situation when the client might want to
suspend the input for a moment.
Workaround: Use AbstractAsyncResponseConsumer instead.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]