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:
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 class
This class enforces the total timeout for exchanges that are still in the queue.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.InvocableCallback, 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
FieldsModifier and TypeFieldDescriptionprivate final HttpClient
private final ClientConnectionFactory
private ConnectionPool
private final Queue<HttpExchange>
private final HttpField
protected static final Logger
private final Origin
private final ProxyConfiguration.Proxy
private final RequestNotifier
private final ResponseNotifier
private final HttpDestination.TimeoutTask
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
Aborts all theHttpExchange
s queued in this destination.asString()
void
close()
void
close
(Connection connection) Deprecated.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
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.protected boolean
enqueue
(Queue<HttpExchange> queue, HttpExchange exchange) void
Callback invoked when the operation fails.getHost()
int
getPort()
getProxy()
int
boolean
isSecure()
void
newConnection
(Promise<Connection> promise) Creates asynchronously a new, unpooled,Connection
that will be returned at a later time through the givenPromise
.protected ConnectionPool
newConnectionPool
(HttpClient client) protected Queue<HttpExchange>
newExchangeQueue
(HttpClient client) protected ClientConnectionFactory
newSslClientConnectionFactory
(ClientConnectionFactory connectionFactory) Deprecated.protected ClientConnectionFactory
newSslClientConnectionFactory
(SslContextFactory sslContextFactory, ClientConnectionFactory connectionFactory) private void
process
(boolean create) private boolean
process
(Connection connection) void
release
(Connection connection) boolean
remove
(Connection connection) boolean
remove
(HttpExchange exchange) void
send()
private void
send
(boolean create) protected abstract SendFailure
send
(Connection connection, HttpExchange exchange) void
send
(Request request, Response.CompleteListener listener) void
send
(HttpExchange exchange) protected void
send
(HttpRequest request, List<Response.ResponseListener> listeners) void
Callback invoked when the operation completes.toString()
private void
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
-
Field Details
-
LOG
-
client
-
origin
-
exchanges
-
requestNotifier
-
responseNotifier
-
proxy
-
connectionFactory
-
hostField
-
timeout
-
connectionPool
-
-
Constructor Details
-
HttpDestination
-
-
Method Details
-
doStart
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classContainerLifeCycle
- Throws:
Exception
-
doStop
Description copied from class:ContainerLifeCycle
Stops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStop
in classContainerLifeCycle
- Throws:
Exception
-
newConnectionPool
-
newExchangeQueue
-
newSslClientConnectionFactory
@Deprecated protected ClientConnectionFactory newSslClientConnectionFactory(ClientConnectionFactory connectionFactory) Deprecated.Creates a newSslClientConnectionFactory
wrapping 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:
getScheme
in interfaceDestination
- Returns:
- the scheme of this destination, such as "http" or "https"
-
getHost
- Specified by:
getHost
in interfaceDestination
- Returns:
- the host of this destination, such as "127.0.0.1" or "google.com"
-
getPort
- Specified by:
getPort
in 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
public void succeeded()Description copied from interface:Callback
Callback invoked when the operation completes.
-
failed
Description copied from interface:Callback
Callback invoked when the operation fails.
-
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:Destination
Creates asynchronously a new, unpooled,Connection
that will be returned at a later time through the givenPromise
.Use
FuturePromise
to wait for the connection:Destination destination = ...; FuturePromise<Connection> futureConnection = new FuturePromise<>(); destination.newConnection(futureConnection); Connection connection = futureConnection.get(5, TimeUnit.SECONDS);
- Specified by:
newConnection
in interfaceDestination
- Parameters:
promise
- the promise of a new, unpooled,Connection
-
createConnection
-
remove
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
release
-
remove
-
close
Deprecated.useremove(Connection)
instead- Parameters:
connection
- the connection to remove
-
abort
Aborts all theHttpExchange
s queued in this destination.- Parameters:
cause
- the abort cause
-
tryRemoveIdleDestination
private void tryRemoveIdleDestination() -
dump
Description copied from interface:Dumpable
Dump 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:
dump
in interfaceDumpable
- Overrides:
dump
in 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:
toString
in classAbstractLifeCycle
-
remove(Connection)
instead