@Contract(threading=SAFE) class ConnectionHolder extends Object implements ConnectionReleaseTrigger, Cancellable, Closeable
Modifier and Type | Field and Description |
---|---|
private org.apache.commons.logging.Log |
log |
private HttpClientConnection |
managedConn |
private HttpClientConnectionManager |
manager |
private AtomicBoolean |
released |
private boolean |
reusable |
private Object |
state |
private TimeUnit |
tunit |
private long |
validDuration |
Constructor and Description |
---|
ConnectionHolder(org.apache.commons.logging.Log log,
HttpClientConnectionManager manager,
HttpClientConnection managedConn) |
Modifier and Type | Method and Description |
---|---|
void |
abortConnection()
Releases the connection without the option of keep-alive.
|
boolean |
cancel() |
void |
close() |
boolean |
isReleased() |
boolean |
isReusable() |
void |
markNonReusable() |
void |
markReusable() |
void |
releaseConnection()
Releases the connection with the option of keep-alive.
|
private void |
releaseConnection(boolean reusable) |
void |
setState(Object state) |
void |
setValidFor(long duration,
TimeUnit tunit) |
private final org.apache.commons.logging.Log log
private final HttpClientConnectionManager manager
private final HttpClientConnection managedConn
private final AtomicBoolean released
private volatile boolean reusable
private volatile long validDuration
public ConnectionHolder(org.apache.commons.logging.Log log, HttpClientConnectionManager manager, HttpClientConnection managedConn)
public boolean isReusable()
public void markReusable()
public void markNonReusable()
public void setValidFor(long duration, TimeUnit tunit)
private void releaseConnection(boolean reusable)
public void releaseConnection()
ConnectionReleaseTrigger
abortConnection
for a hard release. The
connection may be reused as specified by the duration.releaseConnection
in interface ConnectionReleaseTrigger
public void abortConnection()
ConnectionReleaseTrigger
ConnectionReleaseTrigger.releaseConnection()
for a graceful release.abortConnection
in interface ConnectionReleaseTrigger
public boolean cancel()
cancel
in interface Cancellable
public boolean isReleased()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses