Package org.eclipse.jetty.client
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:
java.io.Closeable,java.lang.AutoCloseable,Destination,Callback,Container,Destroyable,Dumpable,Dumpable.DumpableContainer,LifeCycle,Invocable,Sweeper.Sweepable
- Direct Known Subclasses:
MultiplexHttpDestination,PoolingHttpDestination
@ManagedObject public abstract class HttpDestination extends ContainerLifeCycle implements Destination, java.io.Closeable, Callback, Dumpable, Sweeper.Sweepable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
-
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
-
Constructor Summary
Constructors Constructor Description HttpDestination(HttpClient client, Origin origin)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidabort(java.lang.Throwable cause)Aborts all theHttpExchanges queued in this destination.java.lang.StringasString()voidclose()voidclose(Connection connection)Deprecated.useremove(Connection)insteadprotected 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(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 booleanenqueue(java.util.Queue<HttpExchange> queue, HttpExchange exchange)voidfailed(java.lang.Throwable x)Callback invoked when the operation fails.ClientConnectionFactorygetClientConnectionFactory()Origin.AddressgetConnectAddress()ConnectionPoolgetConnectionPool()java.lang.StringgetHost()HttpFieldgetHostField()HttpClientgetHttpClient()java.util.Queue<HttpExchange>getHttpExchanges()longgetIdle()OrigingetOrigin()intgetPort()ProxyConfiguration.ProxygetProxy()intgetQueuedRequestCount()RequestNotifiergetRequestNotifier()ResponseNotifiergetResponseNotifier()java.lang.StringgetScheme()booleanisSecure()booleanisStale()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 java.util.Queue<HttpExchange>newExchangeQueue(HttpClient client)protected ClientConnectionFactorynewSslClientConnectionFactory(ClientConnectionFactory connectionFactory)Deprecated.protected ClientConnectionFactorynewSslClientConnectionFactory(SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory)voidrelease(Connection connection)booleanremove(Connection connection)booleanremove(HttpExchange exchange)voidsend()protected abstract SendFailuresend(Connection connection, HttpExchange exchange)voidsend(Request request, Response.CompleteListener listener)voidsend(HttpExchange exchange)protected voidsend(HttpRequest request, java.util.List<Response.ResponseListener> listeners)booleanstale()voidsucceeded()Callback invoked when the operation completes.booleansweep()java.lang.StringtoString()-
Methods inherited from class org.eclipse.jetty.util.component.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, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Methods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
-
-
-
-
Constructor Detail
-
HttpDestination
public HttpDestination(HttpClient client, Origin origin)
-
-
Method Detail
-
stale
public boolean stale()
-
sweep
public boolean sweep()
- Specified by:
sweepin interfaceSweeper.Sweepable- Returns:
- whether this resource should be swept
-
doStart
protected void doStart() throws java.lang.ExceptionDescription copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classContainerLifeCycle- Throws:
java.lang.Exception
-
doStop
protected void doStop() throws java.lang.ExceptionDescription copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStopin classContainerLifeCycle- Throws:
java.lang.Exception
-
newConnectionPool
protected ConnectionPool newConnectionPool(HttpClient client)
-
newExchangeQueue
protected java.util.Queue<HttpExchange> newExchangeQueue(HttpClient client)
-
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
public HttpClient getHttpClient()
-
getOrigin
public Origin getOrigin()
-
getHttpExchanges
public java.util.Queue<HttpExchange> getHttpExchanges()
-
getRequestNotifier
public RequestNotifier getRequestNotifier()
-
getResponseNotifier
public ResponseNotifier getResponseNotifier()
-
getProxy
public ProxyConfiguration.Proxy getProxy()
-
getClientConnectionFactory
public ClientConnectionFactory getClientConnectionFactory()
-
getScheme
@ManagedAttribute(value="The destination scheme", readonly=true) public java.lang.String getScheme()
- Specified by:
getSchemein interfaceDestination- Returns:
- the scheme of this destination, such as "http" or "https"
-
getHost
@ManagedAttribute(value="The destination host", readonly=true) public java.lang.String getHost()
- Specified by:
getHostin interfaceDestination- Returns:
- the host of this destination, such as "127.0.0.1" or "google.com"
-
getPort
@ManagedAttribute(value="The destination port", readonly=true) public int 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
public Origin.Address getConnectAddress()
-
getHostField
public HttpField getHostField()
-
getConnectionPool
@ManagedAttribute(value="The connection pool", readonly=true) public ConnectionPool getConnectionPool()
-
succeeded
public void succeeded()
Description copied from interface:CallbackCallback invoked when the operation completes.
- Specified by:
succeededin interfaceCallback- See Also:
Callback.failed(Throwable)
-
failed
public void failed(java.lang.Throwable x)
Description copied from interface:CallbackCallback invoked when the operation fails.
-
send
public void send(Request request, Response.CompleteListener listener)
-
send
protected void send(HttpRequest request, java.util.List<Response.ResponseListener> listeners)
-
send
public void send(HttpExchange exchange)
-
enqueue
protected boolean enqueue(java.util.Queue<HttpExchange> queue, HttpExchange exchange)
-
send
public void send()
-
send
protected abstract SendFailure send(Connection connection, HttpExchange exchange)
-
newConnection
public void newConnection(Promise<Connection> promise)
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
protected void createConnection(Promise<Connection> promise)
-
remove
public boolean remove(HttpExchange exchange)
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
release
public void release(Connection connection)
-
remove
public boolean remove(Connection connection)
-
close
@Deprecated public void close(Connection connection)
Deprecated.useremove(Connection)instead- Parameters:
connection- the connection to remove
-
abort
public void abort(java.lang.Throwable cause)
Aborts all theHttpExchanges queued in this destination.- Parameters:
cause- the abort cause
-
dump
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOExceptionDescription 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:
java.io.IOException- if unable to write to Appendable
-
asString
public java.lang.String asString()
-
getIdle
@ManagedAttribute("For how long this destination has been idle in ms") public long getIdle()
-
isStale
@ManagedAttribute("Whether this destinations is stale") public boolean isStale()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractLifeCycle
-
-