hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Fluent HttpClient
Date Mon, 25 Jul 2011 16:17:54 GMT
On Mon, 2011-07-25 at 17:17 +0300, Xu, Lilu wrote:
> Hi Oleg,
> 
> I think the FluentExecutor is quite a good idea, so I implemented it and
> migrated lots of methods from FluentRequest to FluentExecutor. You can learn
> it from the JavaDoc [1] and Wiki [2].

I like it this way much, much better.


> I have also implemented a method exec(FluentRequest[]) for multi-thread
> execution. And here I find a problem: do I need to load all the
> HttpResponse.EntityContent before returning the array of FluentResponse?
> Currently, the exec() method is blocked until all the EntityContent has been
> loaded in (all the content will be loaded into a byte array of
> FluentResponse), because in the tutorial, it seems all entities have been
> consumed in the "run()" method [3].
> 

I would keep it simple and let the caller manager the threads manually.
That would also relieve FluentExecutor form having to worry about
response content.

If one could execute requests concurrently like in this sample app [1]
just using fluent API, that would be sufficient for me. What is
important, though, that FluentExecutor is made thread-safe. I suspect
currently it is not. You need to consider that HttpParams and
HttpContext instances may be accessed concurrently by multiple threads. 

I guess HttpParams, HttpContext and possibly CredentialsProvider should
be managed by FluentRequest and passed to FluentExecutor in some way. 

Oleg

[1]
http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java




> [1]
> http://fluent-hc.googlecode.com/svn/branches/1/doc/fluenthc/FluentExecutor.html
> [2] http://code.google.com/p/fluent-hc/wiki/FluentExecutor
> [3]
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e650
> 
> On Sat, Jul 16, 2011 at 9:47 PM, Oleg Kalnichevski <olegk@apache.org> wrote:
> 
> > On Mon, 2011-07-11 at 16:48 +0300, Xu, Lilu wrote:
> > > Hi Oleg,
> > >
> > > I've accomplished the parts of proxy [1], authentication [2], connection
> > > manager [3] and connection manager builder [4]. Some "to me not so
> > > important" methods are ignored this time.
> > > The progress of the development can still be observed in google doc [4].
> > I
> > > think it should be quite possible to have all essential features listed
> > in
> > > the progress table by the end of July.
> > >
> > > Comments and suggestions (both the codes and the progress) are welcomed!
> > >
> > > [1] http://code.google.com/p/fluent-hc/wiki/ProxyConfiguration
> > > [2] http://code.google.com/p/fluent-hc/wiki/HttpAuthentication
> > > [3] http://code.google.com/p/fluent-hc/wiki/FluentClientConnManager
> > > [4] http://code.google.com/p/fluent-hc/wiki/ConnManagerBuilder
> >
> >
> > Hi Lilu
> >
> > Truth to be told I am not sure I like ConnManagerBuilder /
> > FluentClientConnManager that much. I always felt that a FluentExecutor
> > encapsulating DefaultHttpClient and ThreadSafeClientConnManager would
> > have probably been a more elegant solution. This would also enable us to
> > decouple HttpClient and request execution related methods from
> > FluentRequest.
> >
> > Just a thought.
> >
> > > [5]
> > >
> > https://spreadsheets.google.com/spreadsheet/ccc?key=0AmpiN3H1I3fndFBaOHpoSzI4MHlMS3RaSVg3ZEFrUkE&hl=en_US&authkey=CJTnkIoG
> > >
> >
> > I think we have the almost essential bits already in place. From all
> > missing features listed in the spreadsheet only multi-threaded request
> > execution is really a must in my opinion. I would very much rather
> > prefer that you concentrated on polishing features that are already
> > there instead of adding more.
> >
> > Please look into multi-threaded request execution as the step. As soon
> > as it is done we should start making plans for an official ALPHA release
> > of FluentHC.
> >
> > Oleg
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
> >
> 
> 



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


Mime
View raw message