List of usage examples for org.apache.commons.httpclient HttpClient hashCode
@HotSpotIntrinsicCandidate public native int hashCode();
From source file:com.twinsoft.convertigo.engine.util.HttpUtils.java
public static void logCurrentHttpConnection(HttpClient httpClient, HostConfiguration hostConfiguration, HttpPool poolMode) {// w w w .j a va 2s.c o m if (Engine.logEngine.isInfoEnabled() && httpClient != null) { if (poolMode == HttpPool.no) { Engine.logEngine .info("(HttpUtils) Use a not pooled HTTP connection for " + hostConfiguration.getHost()); } else { HttpConnectionManager httpConnectionManager = httpClient.getHttpConnectionManager(); if (httpConnectionManager != null && httpConnectionManager instanceof MultiThreadedHttpConnectionManager) { MultiThreadedHttpConnectionManager mtHttpConnectionManager = (MultiThreadedHttpConnectionManager) httpConnectionManager; int connections = mtHttpConnectionManager.getConnectionsInPool(); int connectionsForHost = mtHttpConnectionManager.getConnectionsInPool(hostConfiguration); Engine.logEngine.info("(HttpUtils) Use a " + poolMode.name() + " pool with " + connections + " HTTP connections, " + connectionsForHost + " for " + hostConfiguration.getHost() + "; Getting one ... [for instance " + httpClient.hashCode() + "]"); } } } }
From source file:org.collectionspace.chain.csp.persistence.services.connection.ServicesConnection.java
private void doRequest(Returned out, RequestMethod method_type, String uri, RequestDataSource src, CSPRequestCredentials creds, CSPRequestCache cache) throws ConnectionException { InputStream body_data = null; if (src != null) { body_data = src.getStream();/*from ww w.j a va2 s . co m*/ } try { HttpMethod method = createMethod(method_type, uri, body_data); if (body_data != null) { method.setRequestHeader("Content-Type", src.getMIMEType()); // XXX Not sure if or when this ever actually writes to stderr? body_data = new TeeInputStream(body_data, System.err); } try { HttpClient client = makeClient(creds, cache); String requestContext = null; if (perflog.isDebugEnabled()) { // TODO add more context, e.g. session id? requestContext = "HttpClient@" + Integer.toHexString(client.hashCode()); requestContext += "/CSPRequestCache@" + Integer.toHexString(cache.hashCode()) + ","; //String queryString = method.getQueryString(); perflog.debug(System.currentTimeMillis() + ",\"" + Thread.currentThread().getName() + "\",app,svc," + requestContext + method.getName() + " " + method.getURI() //+ (queryString!=null ? queryString : "") ); } int response = client.executeMethod(method); if (perflog.isDebugEnabled()) { perflog.debug(System.currentTimeMillis() + ",\"" + Thread.currentThread().getName() + "\",svc,app," + requestContext + "HttpClient.executeMethod done"); } out.setResponse(method, response); } catch (ConnectionException e) { throw new ConnectionException(e.getMessage(), e.status, base_url + "/" + uri, e); } catch (Exception e) { throw new ConnectionException(e.getMessage(), 0, base_url + "/" + uri, e); } finally { method.releaseConnection(); if (log.isWarnEnabled()) { if (manager.getConnectionsInPool() >= MAX_SERVICES_CONNECTIONS) { log.warn("reached max services connection limit of " + MAX_SERVICES_CONNECTIONS); // Delete closed connections from the pool, so that the warning will cease // once a connection becomes available. manager.deleteClosedConnections(); } } } } finally { closeStream(body_data); } }