/** * Handles calling {@link HttpConnectionManager#closeIdleConnections(long) closeIdleConnections()} * and doing any other cleanup work on the given connection mangaer. * @param connectionManager The connection manager to close idle connections for */ protected void handleCloseIdleConnections(HttpConnectionManager connectionManager) { connectionManager.closeIdleConnections(connectionTimeout); }
public void close() throws IOException { //connectionManager.deleteClosedConnections(); connectionManager.closeIdleConnections(0); }
/** * Handles calling {@link HttpConnectionManager#closeIdleConnections(long) closeIdleConnections()} * and doing any other cleanup work on the given connection mangaer. * @param connectionManager The connection manager to close idle connections for */ protected void handleCloseIdleConnections(HttpConnectionManager connectionManager) { connectionManager.closeIdleConnections(connectionTimeout); }
public void close() throws IOException { //connectionManager.deleteClosedConnections(); connectionManager.closeIdleConnections(0); }
/** * Handles calling {@link HttpConnectionManager#closeIdleConnections(long) closeIdleConnections()} * and doing any other cleanup work on the given connection mangaer. * @param connectionManager The connection manager to close idle connections for */ protected void handleCloseIdleConnections(HttpConnectionManager connectionManager) { connectionManager.closeIdleConnections(connectionTimeout); }
public void close() throws IOException { //connectionManager.deleteClosedConnections(); connectionManager.closeIdleConnections(0); }
/** * Handles calling {@link HttpConnectionManager#closeIdleConnections(long) closeIdleConnections()} * and doing any other cleanup work on the given connection mangaer. * @param connectionManager The connection manager to close idle connections for */ protected void handleCloseIdleConnections(HttpConnectionManager connectionManager) { connectionManager.closeIdleConnections(connectionTimeout); }
/** * Handles calling {@link HttpConnectionManager#closeIdleConnections(long) closeIdleConnections()} * and doing any other cleanup work on the given connection mangaer. * @param connectionManager The connection manager to close idle connections for */ protected void handleCloseIdleConnections(HttpConnectionManager connectionManager) { connectionManager.closeIdleConnections(connectionTimeout); }
@Override public void closeIdleConnections(long idleTimeout) { wrapped.closeIdleConnections(idleTimeout); }
public void run() { HttpConnectionManager connMgr = getHttpClient().getHttpConnectionManager(); connMgr.closeIdleConnections(CONNECTION_EXPIRE_AGE_MILLISECONDS); } }
@Override public void stop() throws Exception { getHttpClient().getHttpConnectionManager().closeIdleConnections( getStopIdleTimeout()); getLogger().info("Stopping the HTTP client"); }
/** * http-GET for rest interface to couchDB * @author daemonmidi@gmail.com * @since version 2.6 * @param url * @return String responseBody */ private String sendGet(String url){ String responseBody = ""; org.apache.commons.httpclient.HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", "jbrofuzz"); GetMethod method = new GetMethod(url); try { // int returnCode = client.executeMethod(method); responseBody = method.getResponseBodyAsString(); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ client.getHttpConnectionManager().closeIdleConnections(0); } return responseBody; }
public static boolean httpPing(String url, String username, String pw) { GetMethod httpMethod = null; HttpClient client = new HttpClient(); HttpConnectionManager connectionManager = client.getHttpConnectionManager(); try { setAuth(client, url, username, pw); httpMethod = new GetMethod(url); connectionManager.getParams().setConnectionTimeout(2000); int status = client.executeMethod(httpMethod); if (status != HttpStatus.SC_OK) { LOGGER.warn("PING failed at '" + url + "': (" + status + ") " + httpMethod.getStatusText()); return false; } else { return true; } } catch (ConnectException e) { return false; } catch (IOException e) { LOGGER.error(e.getLocalizedMessage(),e); return false; } finally { if (httpMethod != null) httpMethod.releaseConnection(); connectionManager.closeIdleConnections(0); } }
/** * http delete for rest interface to couchdb * @author daemonmidi@gmail.com * @since version 2.5 * @param url * @return string repsonsebody * @throws InstantiationException * @throws IllegalAccessException */ private String sendDelete(String url){ String responseBody = ""; DeleteMethod method = new DeleteMethod(url); org.apache.commons.httpclient.HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", "jbrofuzz"); try { client.executeMethod(method); responseBody = method.getResponseBodyAsString(); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ client.getHttpConnectionManager().closeIdleConnections(0); } return responseBody; }
if (httpMethod != null) httpMethod.releaseConnection(); connectionManager.closeIdleConnections(0);
/** * put-method for rest interface to couchdb * @author daemonmidi@gmail.com * @since version 2.5 * @param url * @return string responesBody */ private String sendPut(String url, String requestBody){ String responseBody = ""; org.apache.commons.httpclient.HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", "jbrofuzz"); PutMethod method = new PutMethod(url); // method.getParams().setParameter("retryHandler", new DefaultHttpRequestRetryHandler(3, false)); if (requestBody.length() > 0 ) method.setRequestBody(requestBody); try { responseBody = method.getResponseBodyAsString(); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ client.getHttpConnectionManager().closeIdleConnections(0); } return responseBody; }
if (httpMethod != null) httpMethod.releaseConnection(); connectionManager.closeIdleConnections(0);
if (httpMethod != null) httpMethod.releaseConnection(); connectionManager.closeIdleConnections(0);
if (httpMethod != null) httpMethod.releaseConnection(); connectionManager.closeIdleConnections(0);
idleConnectionTimeout = 5000; client.getHttpConnectionManager().closeIdleConnections(idleConnectionTimeout); client.getHttpConnectionManager().getParams().setConnectionTimeout(idleConnectionTimeout);