Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Jetty HttpClient & ContentExchange

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);

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?

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
4) Do I have to create a new instance of ContentExchange for each request? I will have at most 20 URLs. As I said before there might be 60 requests per minute from among those 20 URLs.

Please help me by answering the 4 questions above. Thanks in advance.

-Zia

Back to the top