Class AbstractHttpClientTransport

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.client.AbstractHttpClientTransport
All Implemented Interfaces:
HttpClient.Aware, HttpClientTransport, org.eclipse.jetty.io.ClientConnectionFactory, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.util.thread.Invocable
Direct Known Subclasses:
AbstractConnectorHttpClientTransport

@ManagedObject public abstract class AbstractHttpClientTransport extends org.eclipse.jetty.util.component.ContainerLifeCycle implements HttpClientTransport
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException

    Nested classes/interfaces inherited from interface org.eclipse.jetty.io.ClientConnectionFactory

    org.eclipse.jetty.io.ClientConnectionFactory.Decorator, org.eclipse.jetty.io.ClientConnectionFactory.Info, org.eclipse.jetty.io.ClientConnectionFactory.Wrapper

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

    org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

    org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.Dumpable.DumpAppendable

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable

    org.eclipse.jetty.util.thread.Invocable.Callable, org.eclipse.jetty.util.thread.Invocable.InvocationType, org.eclipse.jetty.util.thread.Invocable.ReadyTask, org.eclipse.jetty.util.thread.Invocable.Task

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, STARTED, STARTING, STOPPED, STOPPING

    Fields inherited from interface org.eclipse.jetty.io.ClientConnectionFactory

    CONTEXT_KEY

    Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

    LEGEND

    Fields inherited from interface org.eclipse.jetty.util.thread.Invocable

    __nonBlocking, NOOP
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    connectFailed(Map<String,Object> context, Throwable failure)
     
     
    protected HttpClient
     
    org.eclipse.jetty.util.thread.Invocable.InvocationType
     
    void
    Set the factory for ConnectionPool instances.
    void
    Sets the HttpClient instance on this transport.
    void
    setInvocationType(org.eclipse.jetty.util.thread.Invocable.InvocationType invocationType)
    Sets the Invocable.InvocationType associated with this HttpClientTransport.

    Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

    addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans

    Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toString

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.jetty.io.ClientConnectionFactory

    customize, newConnection

    Methods inherited from interface org.eclipse.jetty.util.component.Container

    getCachedBeans, getEventListeners

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

    dumpSelf

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    isDumpable

    Methods inherited from interface HttpClientTransport

    connect, newDestination, newOrigin
  • Constructor Details

    • AbstractHttpClientTransport

      public AbstractHttpClientTransport()
  • Method Details

    • getHttpClient

      protected HttpClient getHttpClient()
    • setHttpClient

      public void setHttpClient(HttpClient client)
      Description copied from interface: HttpClientTransport
      Sets the HttpClient instance on this transport.

      This is needed because of a chicken-egg problem: in order to create the HttpClient a HttpClientTransport is needed, that therefore cannot have a reference yet to the HttpClient.

      Specified by:
      setHttpClient in interface HttpClient.Aware
      Specified by:
      setHttpClient in interface HttpClientTransport
      Parameters:
      client - the HttpClient that uses this transport.
    • getConnectionPoolFactory

      public ConnectionPool.Factory getConnectionPoolFactory()
      Specified by:
      getConnectionPoolFactory in interface HttpClientTransport
      Returns:
      the factory for ConnectionPool instances
    • setConnectionPoolFactory

      public void setConnectionPoolFactory(ConnectionPool.Factory factory)
      Description copied from interface: HttpClientTransport
      Set the factory for ConnectionPool instances.
      Specified by:
      setConnectionPoolFactory in interface HttpClientTransport
      Parameters:
      factory - the factory for ConnectionPool instances
    • connectFailed

      protected void connectFailed(Map<String,Object> context, Throwable failure)
    • getInvocationType

      public org.eclipse.jetty.util.thread.Invocable.InvocationType getInvocationType()
      Specified by:
      getInvocationType in interface HttpClientTransport
      Specified by:
      getInvocationType in interface org.eclipse.jetty.util.thread.Invocable
      Returns:
      the Invocable.InvocationType associated with this HttpClientTransport.
      See Also:
    • setInvocationType

      public void setInvocationType(org.eclipse.jetty.util.thread.Invocable.InvocationType invocationType)
      Description copied from interface: HttpClientTransport

      Sets the Invocable.InvocationType associated with this HttpClientTransport.

      The values are typically either:

      • Invocable.InvocationType.BLOCKING, to indicate that response listeners are executing blocking code, for example blocking network I/O, JDBC, etc.
      • Invocable.InvocationType.NON_BLOCKING, to indicate that response listeners are executing non-blocking code.

      By default, the value is Invocable.InvocationType.BLOCKING.

      A response listener declared to be Invocable.InvocationType.BLOCKING incurs in one additional context switch, where the NIO processing thread delegates the response processing to another thread. This ensures that the NIO processing thread can immediately continue with other NIO processing activities, if any (for example, processing another connection). This also means that processing of different connections is parallelized.

      Invocable.InvocationType.BLOCKING must be used when you want response listeners to be invoked by virtual threads.

      On the other hand, a response listener declared to be Invocable.InvocationType.NON_BLOCKING does not incur in the additional context switch, and therefore it is potentially more efficient. However, the processing of different connections is serialized, which means that the last connection will be processed only after the previous connections (and their respective response listeners) have been processed.

      A response listener declared to be Invocable.InvocationType.NON_BLOCKING, but then executing blocking code, will block the NIO processing performed by HttpClient's implementation: the current connection and possibly other connections will not be further processed, until the blocking response listener returns.

      Specified by:
      setInvocationType in interface HttpClientTransport
      Parameters:
      invocationType - the Invocable.InvocationType associated with this HttpClientTransport.
      See Also: