[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: Non-blocking file upload
From:       Oleg Kalnichevski <olegk () apache ! org>
Date:       2011-02-16 11:54:04
Message-ID: 1297857244.5455.72.camel () ubuntu
[Download RAW message or body]

On Wed, 2011-02-16 at 11:05 +0000, Frazer Irving wrote:
> Hi,
> 

...

> It seems that the call to executeMethod is blocking until the entire 
> body of the RequestEntity has been written to the server before 
> processing the response.

Yes, this is indeed the case due to the limitations of the blocking I/O
model in Java (a thread execution while blocked in an I/O operation is
unable to react to other events).

>  Is there a way to have the response processed 
> earlier? The files in question are very large and I would like to avoid 
> the transfer if possible.
> 

You can try out the asynchronous version of HttpClient, based on NIO,
which does not have such limitation.

http://hc.apache.org/httpcomponents-asyncclient-dev/index.html

Please note, though, HttpAsyncClient is still an early alpha and is
likely to have defects.

Your application will need to implement a custom ProducingNHttpEntity or
HttpAsyncRequestProducer to able to upload data in a non-blocking
manner.

Hope this helps

Oleg 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic