Package org.apache.http.conn
Interface ClientConnectionRequest
public interface ClientConnectionRequest
Encapsulates a request for a
ManagedClientConnection.-
Method Summary
Modifier and Type Method Description voidabortRequest()Aborts the call togetConnection(long, TimeUnit), causing it to throw anInterruptedException.ManagedClientConnectiongetConnection(long timeout, TimeUnit tunit)Obtains a connection within a given time.
-
Method Details
-
getConnection
ManagedClientConnection getConnection(long timeout, TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutExceptionObtains a connection within a given time. This method will block until a connection becomes available, the timeout expires, or the connection manager isshut down. Timeouts are handled with millisecond precision. IfabortRequest()is called while this is blocking or before this began, anInterruptedExceptionwill be thrown.- Parameters:
timeout- the timeout, 0 or negative for no timeouttunit- the unit for thetimeout, may benullonly if there is no timeout- Returns:
- a connection that can be used to communicate along the given route
- Throws:
ConnectionPoolTimeoutException- in case of a timeoutInterruptedException- if the calling thread is interrupted while waiting
-
abortRequest
void abortRequest()Aborts the call togetConnection(long, TimeUnit), causing it to throw anInterruptedException.
-