[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17869561#comment-17869561
 ] 

Oleg Kalnichevski commented on HTTPCLIENT-2334:
-----------------------------------------------

> If returning zero when no data is available is required the documentation 
> should make it a lot more clear

[~a701440] Agreed. Please see proposed javadoc improvements [1]

> I guess the other question is will it keep calling "available()" in a tight 
> loop then?

No, it will not. Output readiness events will get suspended.

Oleg

[1] 
[https://github.com/apache/httpcomponents-core/compare/5.2.x...HTTPCLIENT-2334] 

 

> AsyncDataProducer.produce gets into a tight loop
> ------------------------------------------------
>
>                 Key: HTTPCLIENT-2334
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2334
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient (async)
>    Affects Versions: 5.2.2
>            Reporter: Alex
>            Priority: Major
>
> I am using async data transfer for http request (POST) and using 
> AsyncDataProducer interface produce method. This method seems to be called 
> multiple times in a tight NIO loop when it does not immediately produce data 
> when called. In my case it needs to store the provided DataStreamChannel and 
> return, so that DataStreamChannel can be used later when data for the request 
> is available. However the method seems to be called again immediately in a 
> tight loop and is causing high CPU consumption. Effectively I had to make it 
> blocking which is not the intent of the API.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to