Class HttpDestination
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.client.HttpDestination
- All Implemented Interfaces:
Closeable, AutoCloseable, Destination, Callback, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, Invocable
- Direct Known Subclasses:
MultiplexHttpDestination, PoolingHttpDestination
@ManagedObject
public abstract class HttpDestination
extends ContainerLifeCycle
implements Destination, Closeable, Callback, Dumpable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classThis class enforces the total timeout for exchanges that are still in the queue.Nested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListenerNested classes/interfaces inherited from interface Callback
Callback.Completable, Callback.Completing, Callback.InvocableCallback, Callback.NestedNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface Invocable
Invocable.InvocationTypeNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpClientprivate final ClientConnectionFactoryprivate ConnectionPoolprivate final Queue<HttpExchange> private final HttpFieldprotected static final Loggerprivate final Originprivate final ProxyConfiguration.Proxyprivate final RequestNotifierprivate final ResponseNotifierprivate final HttpDestination.TimeoutTaskFields inherited from interface Invocable
__nonBlocking -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAborts all theHttpExchanges queued in this destination.asString()voidclose()voidclose(Connection connection) Deprecated.protected voidcreateConnection(Promise<Connection> promise) protected voiddoStart()Starts the managed lifecycle beans in the order they were added.protected voiddoStop()Stops the managed lifecycle beans in the reverse order they were added.voiddump(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.protected booleanenqueue(Queue<HttpExchange> queue, HttpExchange exchange) voidCallback invoked when the operation fails.getHost()intgetPort()getProxy()intbooleanisSecure()voidnewConnection(Promise<Connection> promise) Creates asynchronously a new, unpooled,Connectionthat will be returned at a later time through the givenPromise.protected ConnectionPoolnewConnectionPool(HttpClient client) protected Queue<HttpExchange> newExchangeQueue(HttpClient client) protected ClientConnectionFactorynewSslClientConnectionFactory(ClientConnectionFactory connectionFactory) Deprecated.protected ClientConnectionFactorynewSslClientConnectionFactory(SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory) private voidprocess(boolean create) private booleanprocess(Connection connection) voidrelease(Connection connection) booleanremove(Connection connection) booleanremove(HttpExchange exchange) voidsend()private voidsend(boolean create) protected abstract SendFailuresend(Connection connection, HttpExchange exchange) voidsend(Request request, Response.CompleteListener listener) voidsend(HttpExchange exchange) protected voidsend(HttpRequest request, List<Response.ResponseListener> listeners) voidCallback invoked when the operation completes.toString()private voidMethods inherited from class ContainerLifeCycle
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, updateBeansMethods inherited from class AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface Invocable
getInvocationType
-
Field Details
-
LOG
-
client
-
origin
-
exchanges
-
requestNotifier
-
responseNotifier
-
proxy
-
connectionFactory
-
hostField
-
timeout
-
connectionPool
-
-
Constructor Details
-
HttpDestination
-
-
Method Details
-
doStart
Description copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classContainerLifeCycle- Throws:
Exception
-
doStop
Description copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStopin classContainerLifeCycle- Throws:
Exception
-
newConnectionPool
-
newExchangeQueue
-
newSslClientConnectionFactory
@Deprecated protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory) Deprecated.Creates a newSslClientConnectionFactorywrapping the given connection factory.- Parameters:
connectionFactory- the connection factory to wrap- Returns:
- a new SslClientConnectionFactory
-
newSslClientConnectionFactory
protected ClientConnectionFactory newSslClientConnectionFactory(SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory) -
isSecure
public boolean isSecure() -
getHttpClient
-
getOrigin
-
getHttpExchanges
-
getRequestNotifier
-
getResponseNotifier
-
getProxy
-
getClientConnectionFactory
-
getScheme
- Specified by:
getSchemein interfaceDestination- Returns:
- the scheme of this destination, such as "http" or "https"
-
getHost
- Specified by:
getHostin interfaceDestination- Returns:
- the host of this destination, such as "127.0.0.1" or "google.com"
-
getPort
- Specified by:
getPortin interfaceDestination- Returns:
- the port of this destination such as 80 or 443
-
getQueuedRequestCount
@ManagedAttribute(value="The number of queued requests", readonly=true) public int getQueuedRequestCount() -
getConnectAddress
-
getHostField
-
getConnectionPool
@ManagedAttribute(value="The connection pool", readonly=true) public ConnectionPool getConnectionPool() -
succeeded
-
failed
-
send
-
send
-
send
-
enqueue
-
send
public void send() -
send
private void send(boolean create) -
process
private void process(boolean create) -
process
-
send
-
newConnection
Description copied from interface:DestinationCreates asynchronously a new, unpooled,Connectionthat will be returned at a later time through the givenPromise.Use
FuturePromiseto wait for the connection:Destination destination = ...; FuturePromise<Connection> futureConnection = new FuturePromise<>(); destination.newConnection(futureConnection); Connection connection = futureConnection.get(5, TimeUnit.SECONDS);
- Specified by:
newConnectionin interfaceDestination- Parameters:
promise- the promise of a new, unpooled,Connection
-
createConnection
-
remove
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
release
-
remove
-
close
Deprecated.useremove(Connection)instead- Parameters:
connection- the connection to remove
-
abort
Aborts all theHttpExchanges queued in this destination.- Parameters:
cause- the abort cause
-
tryRemoveIdleDestination
private void tryRemoveIdleDestination() -
dump
Description copied from interface:DumpableDump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dumpin interfaceDumpable- Overrides:
dumpin classContainerLifeCycle- Parameters:
out- The appendable to dump toindent- The indent to apply after any new lines.- Throws:
IOException- if unable to write to Appendable
-
asString
-
toString
- Overrides:
toStringin classAbstractLifeCycle
-
remove(Connection)instead