On Tue, 2010-05-25 at 13:06 -0400, Brooks, Kenneth S wrote:
> What would cause this: java.lang.IllegalStateException: Connection already
> open
>
> Never saw this when using httpclient 3.x, recently upgraded to 4.0.1 and saw
> this a few times while running performance tests.
>
> Here are all of the configurations used when constructing the client:
> HttpParams httpParams = new BasicHttpParams();
>
> HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
>
> ConnManagerParams.setMaxTotalConnections(httpParams,
> ClientPropertyLocator.getInstance().getIntProperty(ClientPropertyLocator.HTTP_MAX_TOTAL_CONNECTIONS));
> ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new
> ConnPerRouteBean(ClientPropertyLocator.getInstance().getIntProperty(ClientPropertyLocator.HTTP_MAX_CONNECTIONS_PER_ROUTE)));
>
> HttpConnectionParams.setConnectionTimeout(httpParams,
> ClientPropertyLocator.getInstance().getIntProperty(ClientPropertyLocator.HTTP_CONNECTION_TIMEOUT));
> HttpConnectionParams.setStaleCheckingEnabled(httpParams,
> ClientPropertyLocator.getInstance().getBooleanProperty(ClientPropertyLocator.HTTP_STALE_CONNECTION_CHECK_ENABLED));
> HttpConnectionParams.setSoTimeout(httpParams,
> ClientPropertyLocator.getInstance().getIntProperty(ClientPropertyLocator.HTTP_SOCKET_TIMEOUT));
> HttpConnectionParams.setLinger(httpParams,
> ClientPropertyLocator.getInstance().getIntProperty(ClientPropertyLocator.HTTP_SO_LINGER));
> HttpConnectionParams.setTcpNoDelay(httpParams,
> ClientPropertyLocator.getInstance().getBooleanProperty(ClientPropertyLocator.HTTP_TCP_NODELAY));
>
> SchemeRegistry schemeRegistry = new SchemeRegistry();
> schemeRegistry.register(new Scheme("http",
> PlainSocketFactory.getSocketFactory(), 80));
>
> ClientConnectionManager clientConnectionManager = new
> ThreadSafeClientConnManager(httpParams, schemeRegistry);
>
> IdleConnectionMonitorThread idleConnectionMonitorThread = new
> IdleConnectionMonitorThread(clientConnectionManager);
>
> idleConnectionMonitorThread.setIdleConnectionTimeout(ClientPropertyLocator.getInstance().getIntProperty(ClientPropertyLocator.HTTP_IDLE_CONNECTION_TIMEOUT));
>
> idleConnectionMonitorThread.setIdleConnectionCheckInterval(ClientPropertyLocator.getInstance().getIntProperty(ClientPropertyLocator.HTTP_IDLE_CONNECTION_CHECK_INTERVAL));
> idleConnectionMonitorThread.start();
>
> httpClient = new DefaultHttpClient(clientConnectionManager,
> httpParams);
>
>
Kenneth,
Could you please at the very least post the complete exception stack
trace or try to reproduce the problem with the context logging for
connection management / request execution turned on? For details on
context logging see
http://hc.apache.org/httpcomponents-client-4.0.1/logging.html
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]