Java Code Examples for org.apache.commons.httpclient.HttpConnection#setHttpConnectionManager()
The following examples show how to use
org.apache.commons.httpclient.HttpConnection#setHttpConnectionManager() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadLocalHttpConnectionManager.java From webarchive-commons with Apache License 2.0 | 6 votes |
public void run() { try { while (!Thread.interrupted()) { Thread.sleep(SLEEP_INTERVAL); List<HttpConnection> s; synchronized (connections) { s = connections; connections = new ArrayList<HttpConnection>(); } logger.log(Level.INFO, "Closing " + s.size() + " HttpConnections"); for(final Iterator<HttpConnection> it = s.iterator(); it.hasNext();) { HttpConnection conn = it.next(); conn.close(); conn.setHttpConnectionManager(null); it.remove(); } } } catch (InterruptedException e) { return; } }
Example 2
Source File: SingleHttpConnectionManager.java From webarchive-commons with Apache License 2.0 | 5 votes |
public HttpConnection getConnectionWithTimeout( HostConfiguration hostConfiguration, long timeout) { HttpConnection conn = new HttpConnection(hostConfiguration); conn.setHttpConnectionManager(this); conn.getParams().setDefaults(this.getParams()); return conn; }