Hi Simone, Thank you very much for answering all my questions. May I ask more?
1. I did not find any explanation of the boolean parameter 'cacheFields' ContentExchange(boolean cacheFields) http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/client/ContentExchange.html#ContentExchange(boolean) here in API . Could any one explain please? 2. For blocking method, waitForDone(): "Wait until the exchange is "done". Done is defined as when a final state has been passed to the HttpExchange via the associated onXxx call. Note that an exchange can transit a final state when being used as part of a dialog (eg SecurityListener. Done status is thus defined as: done == onConnectionFailed || onException || onExpire || onRequestComplete && onResponseComplete" I would like to confirm the mapping between these onXxx calls and the corresponding Exceptions they throw and the corresponding HttpExchange Fields returned by the waitForDone() method. Please correct the mapping in the following table if I am wrong and please tell me the value marked ?????. onXxx call Exception Classes HttpExchange Field ----------------------- --------------------- --------------------- onConnectionFailed ConnectException ????? onException Exception STATUS_EXCEPTED onExpire SocketTimeoutException STATUS_EXPIRED onRequestComplete && NOT APPLICABLE STATUS_COMPLETED onResponseComplete Thanks. -Zia Simone Bordet-2 wrote > > Hi, > > On Tue, Mar 13, 2012 at 03:08, Mohammad Ziaul Ahsan <zia7770@> > wrote: >> >> Hi All. I hope I am on the correct place to ask about Jetty HttpClient >> and >> ContentExchange. >> >> I would like to ask you the following questions to see if my >> understanding >> is correct or not: >> 1) According to this API, shall I set the connector type as bellow? >> >> a. for asynchronous mode, >> client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); >> >> b. for synchronous mode, >> client.setConnectorType(HttpClient.CONNECTOR_SOCKET); > > Correct, although it's not exactly "synchronous", but > "blocking"/"non-blocking". > >> 2) As it is said in this tutorial “Since HttpClient does not have any >> settings related to a particular address, it can be used to exchange >> requests/responses with several HTTP servers. You normally need one >> HttpClient instance for all your needs, even if you plan to connect to >> multiple HTTP servers.” >> >> Based on the above lines, can I choose singleton pattern? > > You do not have to. Just create one instance only of the HttpClient, > and pass it where needed. > Singletons are old-fashioned. > >> 3) My application will have 60 requests per min. on average. Will the >> following configuration be sufficient? >> >> client.setMaxConnectionsPerAddress(60); // max 60 concurrent connections >> to every address >> client.setThreadPool(new QueuedThreadPool(60)); // max 60 threads > > Difficult to say, it depends on how much time each request takes to > complete. > >> 4) Do I have to create a new instance of ContentExchange for each >> request? > > Yes. > >> I will have at most 20 URLs. As I said before there might be 60 requests >> per >> minute from among those 20 URLs. > > Fine. > > Simon > -- > http://cometd.org > http://intalio.com > http://bordet.blogspot.com > ---- > Finally, no matter how good the architecture and design are, > to deliver bug-free software with optimal performance and reliability, > the implementation technique must be flawless. Victoria Livschitz > _______________________________________________ > jetty-users mailing list > jetty-users@ > https://dev.eclipse.org/mailman/listinfo/jetty-users > -- View this message in context: http://jetty.4.n6.nabble.com/jetty-users-Jetty-HttpClient-ContentExchange-tp4572518p4576684.html Sent from the Jetty User mailing list archive at Nabble.com. _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
