public class HttpDestination extends Object implements Destination, Closeable, Dumpable
Destination.Address| Constructor and Description |
|---|
HttpDestination(HttpClient client,
String scheme,
String host,
int port) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
abort(HttpExchange exchange,
Throwable cause) |
protected Connection |
acquire() |
void |
close() |
protected void |
createConnection(Promise<Connection> promise) |
String |
dump() |
void |
dump(Appendable out,
String indent) |
protected BlockingQueue<Connection> |
getActiveConnections() |
Destination.Address |
getConnectAddress() |
String |
getHost() |
HttpField |
getHostField() |
protected BlockingQueue<Connection> |
getIdleConnections() |
int |
getPort() |
URI |
getProxyURI() |
RequestNotifier |
getRequestNotifier() |
ResponseNotifier |
getResponseNotifier() |
String |
getScheme() |
boolean |
isProxied() |
void |
newConnection(Promise<Connection> promise)
Creates asynchronously a new, unpooled,
Connection that will be returned
at a later time through the given Promise. |
protected void |
process(Connection connection,
boolean dispatch)
Processes a new connection making it idle or active depending on whether requests are waiting to be sent.
|
void |
release(Connection connection) |
void |
remove(Connection connection) |
boolean |
remove(HttpExchange exchange) |
void |
send(Request request,
List<Response.ResponseListener> listeners) |
String |
toString() |
public HttpDestination(HttpClient client, String scheme, String host, int port)
protected BlockingQueue<Connection> getIdleConnections()
protected BlockingQueue<Connection> getActiveConnections()
public RequestNotifier getRequestNotifier()
public ResponseNotifier getResponseNotifier()
public String getScheme()
getScheme in interface Destinationpublic String getHost()
getHost in interface Destinationpublic int getPort()
getPort in interface Destinationpublic Destination.Address getConnectAddress()
public boolean isProxied()
public URI getProxyURI()
public HttpField getHostField()
public void send(Request request, List<Response.ResponseListener> listeners)
public void newConnection(Promise<Connection> promise)
DestinationConnection that will be returned
at a later time through the given Promise.
Use FuturePromise to wait for the connection:
Destination destination = ...; FuturePromise<Connection> futureConnection = new FuturePromise<>(); destination.newConnection(futureConnection); Connection connection = futureConnection.get(5, TimeUnit.SECONDS);
newConnection in interface Destinationpromise - the promise of a new, unpooled, Connectionprotected void createConnection(Promise<Connection> promise)
protected Connection acquire()
protected void process(Connection connection, boolean dispatch)
Processes a new connection making it idle or active depending on whether requests are waiting to be sent.
A new connection is created when a request needs to be executed; it is possible that the request that triggered the request creation is executed by another connection that was just released, so the new connection may become idle.
If a request is waiting to be executed, it will be dequeued and executed by the new connection.
connection - the new connectiondispatch - whether to dispatch the processing to another threadpublic void release(Connection connection)
public void remove(Connection connection)
public void close()
close in interface Closeableclose in interface AutoCloseablepublic boolean remove(HttpExchange exchange)
protected void abort(HttpExchange exchange, Throwable cause)
public void dump(Appendable out, String indent) throws IOException
dump in interface DumpableIOExceptionCopyright © 1995-2014 Mort Bay Consulting. All Rights Reserved.