org.apache.commons.vfs.provider.http
Class ThreadLocalHttpConnectionManager

java.lang.Object
  extended by org.apache.commons.vfs.provider.http.ThreadLocalHttpConnectionManager
All Implemented Interfaces:
org.apache.commons.httpclient.HttpConnectionManager

public class ThreadLocalHttpConnectionManager
extends java.lang.Object
implements org.apache.commons.httpclient.HttpConnectionManager

A connection manager that provides access to a single HttpConnection. This manager makes no attempt to provide exclusive access to the contained HttpConnection.

imario@apache.org: Keep connection in ThreadLocal.

Since:
2.0
Author:
Mario Ivankovits, Michael Becke, Eric Johnson, Mike Bowler, Oleg Kalnichevski, Laura Werner

Field Summary
protected  java.lang.ThreadLocal localHttpConnection
          The thread data
 
Constructor Summary
ThreadLocalHttpConnectionManager()
           
 
Method Summary
 void closeIdleConnections(long idleTimeout)
           
 org.apache.commons.httpclient.HttpConnection getConnection(org.apache.commons.httpclient.HostConfiguration hostConfiguration)
           
 org.apache.commons.httpclient.HttpConnection getConnection(org.apache.commons.httpclient.HostConfiguration hostConfiguration, long timeout)
          Deprecated. Use #getConnectionWithTimeout(HostConfiguration, long)
 org.apache.commons.httpclient.HttpConnection getConnectionWithTimeout(org.apache.commons.httpclient.HostConfiguration hostConfiguration, long timeout)
           
protected  long getIdleStartTime()
           
protected  org.apache.commons.httpclient.HttpConnection getLocalHttpConnection()
           
 org.apache.commons.httpclient.params.HttpConnectionManagerParams getParams()
           
 boolean isConnectionStaleCheckingEnabled()
          Gets the staleCheckingEnabled value to be set on HttpConnections that are created.
 void releaseConnection(org.apache.commons.httpclient.HttpConnection conn)
           
 void releaseLocalConnection()
          release the connection of the current thread
 void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
          Sets the staleCheckingEnabled value to be set on HttpConnections that are created.
protected  void setIdleStartTime(long idleStartTime)
           
protected  void setLocalHttpConnection(org.apache.commons.httpclient.HttpConnection conn)
           
 void setParams(org.apache.commons.httpclient.params.HttpConnectionManagerParams params)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localHttpConnection

protected java.lang.ThreadLocal localHttpConnection
The thread data

Constructor Detail

ThreadLocalHttpConnectionManager

public ThreadLocalHttpConnectionManager()
Method Detail

releaseLocalConnection

public void releaseLocalConnection()
release the connection of the current thread


getLocalHttpConnection

protected org.apache.commons.httpclient.HttpConnection getLocalHttpConnection()

setLocalHttpConnection

protected void setLocalHttpConnection(org.apache.commons.httpclient.HttpConnection conn)

getIdleStartTime

protected long getIdleStartTime()

setIdleStartTime

protected void setIdleStartTime(long idleStartTime)

getConnection

public org.apache.commons.httpclient.HttpConnection getConnection(org.apache.commons.httpclient.HostConfiguration hostConfiguration)
Specified by:
getConnection in interface org.apache.commons.httpclient.HttpConnectionManager
See Also:
HttpConnectionManager.getConnection(org.apache.commons.httpclient.HostConfiguration)

isConnectionStaleCheckingEnabled

public boolean isConnectionStaleCheckingEnabled()
Gets the staleCheckingEnabled value to be set on HttpConnections that are created.

Returns:
true if stale checking will be enabled on HttpConections
See Also:
HttpConnection.isStaleCheckingEnabled()

setConnectionStaleCheckingEnabled

public void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
Sets the staleCheckingEnabled value to be set on HttpConnections that are created.

Parameters:
connectionStaleCheckingEnabled - true if stale checking will be enabled on HttpConections
See Also:
HttpConnection.setStaleCheckingEnabled(boolean)

getConnectionWithTimeout

public org.apache.commons.httpclient.HttpConnection getConnectionWithTimeout(org.apache.commons.httpclient.HostConfiguration hostConfiguration,
                                                                             long timeout)
Specified by:
getConnectionWithTimeout in interface org.apache.commons.httpclient.HttpConnectionManager
Since:
3.0
See Also:
HttpConnectionManager.getConnection(HostConfiguration, long)

getConnection

public org.apache.commons.httpclient.HttpConnection getConnection(org.apache.commons.httpclient.HostConfiguration hostConfiguration,
                                                                  long timeout)
Deprecated. Use #getConnectionWithTimeout(HostConfiguration, long)

Specified by:
getConnection in interface org.apache.commons.httpclient.HttpConnectionManager
See Also:
HttpConnectionManager.getConnection(HostConfiguration, long)

releaseConnection

public void releaseConnection(org.apache.commons.httpclient.HttpConnection conn)
Specified by:
releaseConnection in interface org.apache.commons.httpclient.HttpConnectionManager
See Also:
HttpConnectionManager.releaseConnection(org.apache.commons.httpclient.HttpConnection)

closeIdleConnections

public void closeIdleConnections(long idleTimeout)
Specified by:
closeIdleConnections in interface org.apache.commons.httpclient.HttpConnectionManager
Since:
3.0

getParams

public org.apache.commons.httpclient.params.HttpConnectionManagerParams getParams()
Specified by:
getParams in interface org.apache.commons.httpclient.HttpConnectionManager

setParams

public void setParams(org.apache.commons.httpclient.params.HttpConnectionManagerParams params)
Specified by:
setParams in interface org.apache.commons.httpclient.HttpConnectionManager


Copyright © 2002-2011 Apache Software Foundation. All Rights Reserved.