Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why all methods are deprecated in PoolingClientConnectionManager?

In Apache httpclient 4.*, why all the methods are deprecated? If all are deprecated , how can we use this class effectively.

When I do a PoolingClientConnectionManager.getTotalStats()

I see the following output

[leased: 2; pending: 0; available: 0; max: 20], and I never see available being above 0 at any concurrency.

Please advise.

like image 950
Maruthi Shanmugam Avatar asked Jan 30 '15 05:01

Maruthi Shanmugam


People also ask

What is poolingclientconnectionmanager in http?

@Deprecated@Contract(threading=SAFE_CONDITIONAL) public class PoolingClientConnectionManager extends Object implements ClientConnectionManager, org.apache.http.pool.ConnPoolControl<HttpRoute> Manages a pool of OperatedClientConnectionand is able to service connection requests from multiple execution threads.

What does clientconnectionmanager closeexpiredconnections do?

ClientConnectionManager.closeExpiredConnections() shutdown public void shutdown() Deprecated. Description copied from interface: ClientConnectionManager Shuts down this connection manager and releases allocated resources. This includes closing all connections, whether they are currently used or not. Specified by:

What does the method closeexpiredconnections do?

public void closeExpiredConnections() Deprecated. Description copied from interface: ClientConnectionManager Closes all expired connections in the pool. Open connections in the pool that have not been used for the timespan defined when the connection was released will be closed. Currently allocated connections are not subject to this method.

What is the maximum number of connections a client connection pool can create?

ClientConnectionPoolManager maintains a maximum limit of connection on a per route basis and in total. Per default this implementation will create no more than than 2 concurrent connections per given route and no more 20 connections in total.


1 Answers

http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingClientConnectionManager.html

The class PoolingClientConnectionManager itself is deprecated, so all methods are deprecated. Don't use the class. Instead, use PoolingHttpClientConnectionManager.

like image 176
johnchen902 Avatar answered Sep 20 '22 10:09

johnchen902