@ManagedObject public abstract class HttpDestination extends ContainerLifeCycle implements Destination, Closeable, Callback, Dumpable
AbstractLifeCycle.AbstractLifeCycleListener
Callback.Completable, Callback.Nested
Invocable.InvocationType
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOG |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
__nonBlocking
Constructor and Description |
---|
HttpDestination(HttpClient client,
Origin origin) |
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asPreferred, getInvocationType, getInvocationType, invokeNonBlocking, invokePreferNonBlocking, invokePreferred, isNonBlockingInvocation
protected static final Logger LOG
public HttpDestination(HttpClient client, Origin origin)
protected void doStart() throws Exception
ContainerLifeCycle
doStart
in class ContainerLifeCycle
Exception
protected void doStop() throws Exception
ContainerLifeCycle
doStop
in class ContainerLifeCycle
Exception
protected abstract ConnectionPool newConnectionPool(HttpClient client)
protected Queue<HttpExchange> newExchangeQueue(HttpClient client)
protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory)
public boolean isSecure()
public HttpClient getHttpClient()
public Origin getOrigin()
public Queue<HttpExchange> getHttpExchanges()
public RequestNotifier getRequestNotifier()
public ResponseNotifier getResponseNotifier()
public ProxyConfiguration.Proxy getProxy()
public ClientConnectionFactory getClientConnectionFactory()
@ManagedAttribute(value="The destination scheme", readonly=true) public String getScheme()
getScheme
in interface Destination
@ManagedAttribute(value="The destination host", readonly=true) public 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()
Callback
Callback invoked when the operation completes.
succeeded
in interface Callback
Callback.failed(Throwable)
public void failed(Throwable x)
Callback
Callback invoked when the operation fails.
protected void send(HttpRequest request, List<Response.ResponseListener> listeners)
protected boolean enqueue(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)
Destination
Connection
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 Destination
promise
- the promise of a new, unpooled, Connection
protected void createConnection(Promise<Connection> promise)
public boolean remove(HttpExchange exchange)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void release(Connection connection)
public boolean remove(Connection connection)
public void close(Connection connection)
public void abort(Throwable cause)
HttpExchange
s queued in this destination.cause
- the abort causepublic String dump()
dump
in interface Dumpable
dump
in class ContainerLifeCycle
public void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
dump
in class ContainerLifeCycle
IOException
public String asString()
Copyright © 1995–2017 Webtide. All rights reserved.