public void setLinger (int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (final int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (final int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (final int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (final int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (int linger) { HttpConnectionParams.setLinger(params, linger); }
public void setLinger (final int linger) { HttpConnectionParams.setLinger(params, linger); }
public static HttpParams buildHttpParams() { int so_timeout = conparams.getInt("http.socket.timeout", 30);//以秒为单位 int CONNECTION_TIMEOUT = conparams.getInt("http.connection.timeout",30); int CONNECTION_Manager_TIMEOUT = conparams.getInt("http.conn-manager.timeout",2); int httpsoLinger = conparams.getInt("http.soLinger",-1); HttpParams params = new BasicHttpParams(); HttpConnectionParams.setSoTimeout(params, so_timeout * 1000); HttpConnectionParams.setConnectionTimeout(params, CONNECTION_TIMEOUT * 1000); HttpConnectionParams.setLinger(params, httpsoLinger ); ConnManagerParams.setTimeout(params, CONNECTION_Manager_TIMEOUT * 1000); // params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, // "org.frameworkset.spi.remote.http.BBossClientConnectionManagerFactory"); return params; }
/** * Creates an instance of <tt>DefaultHttpClient</tt> with a <tt>ThreadSafeClientConnManager</tt>. * @return an implementation of the <tt>HttpClient</tt> interface. */ public HttpClient createInstance() { LOGGER.debug("Creating a new instance of DefaultHttpClient with configuration -> {}", toString()); // Create the connection manager which will be default create the necessary schema registry stuff... final PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(); connectionManager.setMaxTotal(maxTotalConnections); connectionManager.setDefaultMaxPerRoute(maxConnectionsPerRoute); // Set the HTTP connection parameters (These are in the HttpCore JavaDocs, NOT the HttpClient ones)... final HttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, connectionTimeout); HttpConnectionParams.setLinger(params, linger); HttpConnectionParams.setSocketBufferSize(params, socketBufferSize); HttpConnectionParams.setSoKeepalive(params, soKeepAlive); HttpConnectionParams.setSoReuseaddr(params, soReuseAddr); HttpConnectionParams.setSoTimeout(params, soTimeout); HttpConnectionParams.setStaleCheckingEnabled(params, staleCheckingEnabled); HttpConnectionParams.setTcpNoDelay(params, tcpNoDelay); // Create the HttpClient and configure the compression interceptors if required... final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, params); if (useCompression) { httpClient.addRequestInterceptor(new RequestAcceptEncoding()); httpClient.addResponseInterceptor(new DeflateContentEncoding()); } return httpClient; }
HttpConnectionParams.setLinger(httpClientParams, Integer.parseInt("" + ncc.getProperty(CommonClientConfigKey.Linger)));