@ManagedObject public abstract class HttpDestination extends ContainerLifeCycle implements Destination, java.io.Closeable, Callback, Dumpable
AbstractLifeCycle.AbstractLifeCycleListenerCallback.Completable, Callback.NestedInvocable.InvocationTypeContainer.InheritedListener, Container.ListenerLifeCycle.Listener| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
LOG |
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING__nonBlocking| Constructor and Description |
|---|
HttpDestination(HttpClient client,
Origin origin) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(java.lang.Throwable cause)
Aborts all the
HttpExchanges queued in this destination. |
java.lang.String |
asString() |
void |
close() |
void |
close(Connection connection) |
protected void |
createConnection(Promise<Connection> promise) |
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
void |
dump(java.lang.Appendable out,
java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
protected boolean |
enqueue(java.util.Queue<HttpExchange> queue,
HttpExchange exchange) |
void |
failed(java.lang.Throwable x)
Callback invoked when the operation fails.
|
ClientConnectionFactory |
getClientConnectionFactory() |
Origin.Address |
getConnectAddress() |
ConnectionPool |
getConnectionPool() |
java.lang.String |
getHost() |
HttpField |
getHostField() |
HttpClient |
getHttpClient() |
java.util.Queue<HttpExchange> |
getHttpExchanges() |
Origin |
getOrigin() |
int |
getPort() |
ProxyConfiguration.Proxy |
getProxy() |
int |
getQueuedRequestCount() |
RequestNotifier |
getRequestNotifier() |
ResponseNotifier |
getResponseNotifier() |
java.lang.String |
getScheme() |
boolean |
isSecure() |
void |
newConnection(Promise<Connection> promise)
Creates asynchronously a new, unpooled,
Connection that will be returned
at a later time through the given Promise. |
protected ConnectionPool |
newConnectionPool(HttpClient client) |
protected java.util.Queue<HttpExchange> |
newExchangeQueue(HttpClient client) |
protected ClientConnectionFactory |
newSslClientConnectionFactory(ClientConnectionFactory connectionFactory) |
boolean |
process(Connection connection) |
void |
release(Connection connection) |
boolean |
remove(Connection connection) |
boolean |
remove(HttpExchange exchange) |
void |
send() |
protected abstract SendFailure |
send(Connection connection,
HttpExchange exchange) |
void |
send(HttpExchange exchange) |
protected void |
send(HttpRequest request,
java.util.List<Response.ResponseListener> listeners) |
void |
succeeded()
Callback invoked when the operation completes.
|
java.lang.String |
toString() |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetInvocationType, getInvocationType, invokeNonBlocking, isNonBlockingInvocationdump, dump, dumpObject, dumpObjects, dumpSelfprotected static final Logger LOG
public HttpDestination(HttpClient client, Origin origin)
protected void doStart()
throws java.lang.Exception
ContainerLifeCycledoStart in class ContainerLifeCyclejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
ContainerLifeCycledoStop in class ContainerLifeCyclejava.lang.Exceptionprotected ConnectionPool newConnectionPool(HttpClient client)
protected java.util.Queue<HttpExchange> newExchangeQueue(HttpClient client)
protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
public boolean isSecure()
public HttpClient getHttpClient()
public Origin getOrigin()
public java.util.Queue<HttpExchange> getHttpExchanges()
public RequestNotifier getRequestNotifier()
public ResponseNotifier getResponseNotifier()
public ProxyConfiguration.Proxy getProxy()
public ClientConnectionFactory getClientConnectionFactory()
@ManagedAttribute(value="The destination scheme", readonly=true) public java.lang.String getScheme()
getScheme in interface Destination@ManagedAttribute(value="The destination host", readonly=true) public java.lang.String getHost()
getHost in interface Destination@ManagedAttribute(value="The destination port", readonly=true) public int getPort()
getPort in interface Destination@ManagedAttribute(value="The number of queued requests", readonly=true) public int getQueuedRequestCount()
public Origin.Address getConnectAddress()
public HttpField getHostField()
@ManagedAttribute(value="The connection pool", readonly=true) public ConnectionPool getConnectionPool()
public void succeeded()
CallbackCallback invoked when the operation completes.
succeeded in interface CallbackCallback.failed(Throwable)public void failed(java.lang.Throwable x)
CallbackCallback invoked when the operation fails.
protected void send(HttpRequest request, java.util.List<Response.ResponseListener> listeners)
public void send(HttpExchange exchange)
protected boolean enqueue(java.util.Queue<HttpExchange> queue, HttpExchange exchange)
public void send()
public boolean process(Connection connection)
protected abstract SendFailure send(Connection connection, HttpExchange exchange)
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)
public boolean remove(HttpExchange exchange)
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void release(Connection connection)
public boolean remove(Connection connection)
public void close(Connection connection)
public void abort(java.lang.Throwable cause)
HttpExchanges queued in this destination.cause - the abort causepublic void dump(java.lang.Appendable out,
java.lang.String indent)
throws java.io.IOException
Dumpabledump in interface Dumpabledump in class ContainerLifeCycleout - The appendable to dump toindent - The indent to apply after any new lines.java.io.IOException - if unable to write to Appendablepublic java.lang.String asString()
public java.lang.String toString()
toString in class AbstractLifeCycleCopyright © 1995–2021 Webtide. All rights reserved.