You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Bodo Junglas (JIRA)" <ji...@apache.org> on 2013/04/25 09:44:15 UTC
[jira] [Created] (HTTPASYNC-40) Cannot suspend input when using
AsyncByteConsumer
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org