Top Description Fields Constructors Methods
org.apache.http.impl.execchain

pack-priv Class ConnectionHolder

extends Object
implements ConnectionReleaseTrigger, Cancellable, Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable, org.apache.http.concurrent.Cancellable, org.apache.http.conn.ConnectionReleaseTrigger
Annotations
@Contract
threading:SAFE
Imports
java.io.Closeable, .IOException, java.util.concurrent.TimeUnit, java.util.concurrent.atomic.AtomicBoolean, org.apache.commons.logging.Log, org.apache.http.HttpClientConnection, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.concurrent.Cancellable, org.apache.http.conn.ConnectionReleaseTrigger, .HttpClientConnectionManager

Internal connection holder.
Since
4.3

Field Summary

Modifier and TypeField and Description
private final Log
private final HttpClientConnection
private final HttpClientConnectionManager
private final AtomicBoolean
private volatile boolean
private volatile Object
private volatile TimeUnit
private volatile long

Constructor Summary

AccessConstructor and Description
public
ConnectionHolder(final Log log, final HttpClientConnectionManager manager, final HttpClientConnection managedConn)

Method Summary

Modifier and TypeMethod and Description
public void
abortConnection()

Implements org.apache.http.conn.ConnectionReleaseTrigger.abortConnection.

Releases the connection without the option of keep-alive.
public boolean
cancel()

Implements org.apache.http.concurrent.Cancellable.cancel.

Cancels the ongoing operation or process.
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public boolean
public boolean
public void
public void
private void
releaseConnection(final boolean reusable)

public void
releaseConnection()

Implements org.apache.http.conn.ConnectionReleaseTrigger.releaseConnection.

Releases the connection with the option of keep-alive.
public void
setState(final Object state)

public void
setValidFor(final long duration, final TimeUnit timeUnit)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private final Log log
managedConnback to summary
private final HttpClientConnection managedConn
managerback to summary
private final HttpClientConnectionManager manager
releasedback to summary
private final AtomicBoolean released
reusableback to summary
private volatile boolean reusable
stateback to summary
private volatile Object state
timeUnitback to summary
private volatile TimeUnit timeUnit
validDurationback to summary
private volatile long validDuration

Constructor Detail

ConnectionHolderback to summary
public ConnectionHolder(final Log log, final HttpClientConnectionManager manager, final HttpClientConnection managedConn)

Method Detail

abortConnectionback to summary
public void abortConnection()

Implements org.apache.http.conn.ConnectionReleaseTrigger.abortConnection.

Doc from org.apache.http.conn.ConnectionReleaseTrigger.abortConnection.

Releases the connection without the option of keep-alive. This is a "hard" release that implies a shutdown of the connection. Use releaseConnection() for a graceful release.

Annotations
@Override
cancelback to summary
public boolean cancel()

Implements org.apache.http.concurrent.Cancellable.cancel.

Doc from org.apache.http.concurrent.Cancellable.cancel.

Cancels the ongoing operation or process.

Returns:boolean

true if the operation or process has been cancelled as a result of this method call or false if it has already been cancelled or not started.

Annotations
@Override
closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
isReleasedback to summary
public boolean isReleased()
isReusableback to summary
public boolean isReusable()
markNonReusableback to summary
public void markNonReusable()
markReusableback to summary
public void markReusable()
releaseConnectionback to summary
private void releaseConnection(final boolean reusable)
releaseConnectionback to summary
public void releaseConnection()

Implements org.apache.http.conn.ConnectionReleaseTrigger.releaseConnection.

Doc from org.apache.http.conn.ConnectionReleaseTrigger.releaseConnection.

Releases the connection with the option of keep-alive. This is a "graceful" release and may cause IO operations for consuming the remainder of a response entity. Use abortConnection for a hard release. The connection may be reused as specified by the duration.

Annotations
@Override
setStateback to summary
public void setState(final Object state)
setValidForback to summary
public void setValidFor(final long duration, final TimeUnit timeUnit)