Class HTTP2Connection

java.lang.Object
org.eclipse.jetty.io.AbstractConnection
org.eclipse.jetty.http2.HTTP2Connection
All Implemented Interfaces:
Closeable, AutoCloseable, Parser.Listener, Connection, Connection.UpgradeTo, WriteFlusher.Listener
Direct Known Subclasses:
HTTP2ServerConnection

public class HTTP2Connection extends AbstractConnection implements Parser.Listener, WriteFlusher.Listener, Connection.UpgradeTo
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
  • Constructor Details

  • Method Details

    • getMessagesIn

      public long getMessagesIn()
      Specified by:
      getMessagesIn in interface Connection
      Overrides:
      getMessagesIn in class AbstractConnection
    • getMessagesOut

      public long getMessagesOut()
      Specified by:
      getMessagesOut in interface Connection
      Overrides:
      getMessagesOut in class AbstractConnection
    • getBytesIn

      public long getBytesIn()
      Specified by:
      getBytesIn in interface Connection
      Overrides:
      getBytesIn in class AbstractConnection
    • getBytesOut

      public long getBytesOut()
      Specified by:
      getBytesOut in interface Connection
      Overrides:
      getBytesOut in class AbstractConnection
    • getSession

      public ISession getSession()
    • onUpgradeTo

      public void onUpgradeTo(ByteBuffer buffer)
      Description copied from interface: Connection.UpgradeTo

      Invoked during an upgrade to receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.

      Specified by:
      onUpgradeTo in interface Connection.UpgradeTo
      Parameters:
      buffer - a non-null buffer of unconsumed bytes received from the upgrade-from connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes.
    • isUseInputDirectByteBuffers

      public boolean isUseInputDirectByteBuffers()
    • setUseInputDirectByteBuffers

      public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
    • isUseOutputDirectByteBuffers

      public boolean isUseOutputDirectByteBuffers()
    • setUseOutputDirectByteBuffers

      public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
    • onOpen

      public void onOpen()
      Description copied from interface: Connection

      Callback method invoked when this connection is opened.

      Creators of the connection implementation are responsible for calling this method.

      Specified by:
      onOpen in interface Connection
      Overrides:
      onOpen in class AbstractConnection
    • onClose

      public void onClose(Throwable cause)
      Description copied from interface: Connection

      Callback method invoked when this connection is closed.

      Creators of the connection implementation are responsible for calling this method.

      Specified by:
      onClose in interface Connection
      Overrides:
      onClose in class AbstractConnection
      Parameters:
      cause - The cause of the close or null for a normal close
    • onFillable

      public void onFillable()
      Description copied from class: AbstractConnection

      Callback method invoked when the endpoint is ready to be read.

      Specified by:
      onFillable in class AbstractConnection
      See Also:
    • onIdleExpired

      public boolean onIdleExpired()
      Description copied from interface: Connection

      Callback method invoked upon an idle timeout event.

      Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.

      When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.

      Specified by:
      onIdleExpired in interface Connection
      Overrides:
      onIdleExpired in class AbstractConnection
      Returns:
      true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
    • offerTask

      protected void offerTask(Runnable task, boolean dispatch)
    • produce

      protected void produce()
    • dispatch

      protected void dispatch()
    • close

      public void close()
      Description copied from interface: Connection

      Performs a logical close of this connection.

      For simple connections, this may just mean to delegate the close to the associated EndPoint but, for example, SSL connections should write the SSL close message before closing the associated EndPoint.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Connection
      Overrides:
      close in class AbstractConnection
    • onHeaders

      public void onHeaders(HeadersFrame frame)
      Specified by:
      onHeaders in interface Parser.Listener
    • onData

      public void onData(DataFrame frame)
      Specified by:
      onData in interface Parser.Listener
    • onPriority

      public void onPriority(PriorityFrame frame)
      Specified by:
      onPriority in interface Parser.Listener
    • onReset

      public void onReset(ResetFrame frame)
      Specified by:
      onReset in interface Parser.Listener
    • onSettings

      public void onSettings(SettingsFrame frame)
      Specified by:
      onSettings in interface Parser.Listener
    • onPushPromise

      public void onPushPromise(PushPromiseFrame frame)
      Specified by:
      onPushPromise in interface Parser.Listener
    • onPing

      public void onPing(PingFrame frame)
      Specified by:
      onPing in interface Parser.Listener
    • onGoAway

      public void onGoAway(GoAwayFrame frame)
      Specified by:
      onGoAway in interface Parser.Listener
    • onWindowUpdate

      public void onWindowUpdate(WindowUpdateFrame frame)
      Specified by:
      onWindowUpdate in interface Parser.Listener
    • onStreamFailure

      public void onStreamFailure(int streamId, int error, String reason)
      Specified by:
      onStreamFailure in interface Parser.Listener
    • onConnectionFailure

      public void onConnectionFailure(int error, String reason)
      Specified by:
      onConnectionFailure in interface Parser.Listener
    • onFlushed

      public void onFlushed(long bytes) throws IOException
      Description copied from interface: WriteFlusher.Listener

      Invoked when a WriteFlusher flushed bytes in a non-blocking way, as part of a - possibly larger - write.

      This method may be invoked multiple times, for example when writing a large buffer: a first flush of bytes, then the connection became TCP congested, and a subsequent flush of bytes when the connection became writable again.

      This method is never invoked concurrently, but may be invoked by different threads, so implementations may not rely on thread-local variables.

      Implementations may throw an IOException to signal that the write should fail, for example if the implementation enforces a minimum data rate.

      Specified by:
      onFlushed in interface WriteFlusher.Listener
      Parameters:
      bytes - the number of bytes flushed
      Throws:
      IOException - if the write should fail