Class AbstractH2StreamMultiplexer
java.lang.Object
org.apache.hc.core5.http2.impl.nio.AbstractH2StreamMultiplexer
- All Implemented Interfaces:
Closeable,AutoCloseable,HttpConnection,SocketModalCloseable,ModalCloseable,Identifiable
- Direct Known Subclasses:
ClientH2StreamMultiplexer,ServerH2StreamMultiplexer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enumprivate static class(package private) static classprivate class(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longprivate final AtomicIntegerprivate final BasicHttpConnectionMetricsprivate final AtomicIntegerprivate EndpointDetailsprivate final FrameFactoryprivate booleanprivate final HPackDecoderprivate final HPackEncoderprivate final HttpProcessorprivate final StreamIdGeneratorprivate intprivate intprivate final FrameInputBufferprivate final BasicH2TransportMetricsprivate final ProtocolIOSessionprivate final AtomicIntegerprivate static final longprivate final H2Configprivate intprivate final FrameOutputBufferprivate final BasicH2TransportMetricsprivate final AtomicIntegerprivate final Queue<AsyncPingHandler> private intprivate H2Configprivate final H2StreamListenerprivate final Map<Integer, AbstractH2StreamMultiplexer.H2Stream> -
Constructor Summary
ConstructorsConstructorDescriptionAbstractH2StreamMultiplexer(ProtocolIOSession ioSession, FrameFactory frameFactory, StreamIdGenerator idGenerator, HttpProcessor httpProcessor, CharCodingConfig charCodingConfig, H2Config h2Config, H2StreamListener streamListener) -
Method Summary
Modifier and TypeMethodDescription(package private) abstract void(package private) abstract void(package private) abstract void(package private) voidappendState(StringBuilder buf) private voidprivate voidapplyRemoteSettings(H2Config config) voidclose()Closes this connection gracefully.voidCloses this process or endpoint and releases any system resources associated with it.private voidcommitFrame(RawFrame frame) private voidcommitFrameInternal(RawFrame frame) private voidcommitHeaders(int streamId, List<? extends Header> headers, boolean endStream) private voidcommitPushPromise(int streamId, int promisedStreamId, List<Header> headers) private voidconsumeContinuationFrame(RawFrame frame, AbstractH2StreamMultiplexer.H2Stream stream) private voidconsumeDataFrame(RawFrame frame, AbstractH2StreamMultiplexer.H2Stream stream) private voidconsumeFrame(RawFrame frame) private voidconsumeHeaderFrame(RawFrame frame, AbstractH2StreamMultiplexer.H2Stream stream) private voidconsumePushPromiseFrame(RawFrame frame, ByteBuffer payload, AbstractH2StreamMultiplexer.H2Stream promisedStream) private voidconsumeSettingsFrame(ByteBuffer payload) (package private) abstract H2StreamHandlercreateLocallyInitiatedStream(ExecutableCommand command, H2StreamChannel channel, HttpProcessor httpProcessor, BasicHttpConnectionMetrics connMetrics) (package private) abstract H2StreamHandlercreateRemotelyInitiatedStream(H2StreamChannel channel, HttpProcessor httpProcessor, BasicHttpConnectionMetrics connMetrics, HandlerFactory<AsyncPushConsumer> pushHandlerFactory) decodeHeaders(ByteBuffer payload) private intReturns this connection's endpoint details.getId()Returns this connection's local address ornullif it is not bound yet.Returns this connection's protocol version ornullif unknown.Returns this connection's remote address ornullif it is not connected yet or unconnected.Returns the socket timeout value.Returns this connection's SSL session ornullif TLS has not been activated.getValidStream(int streamId) private voidincrementInputCapacity(int streamId, AtomicInteger inputWindow, int inputCapacity) booleanisOpen()Checks if this connection is open.private voidmaximizeConnWindow(int connWinSize) final voidfinal voidfinal voidonException(Exception cause) final voidonInput(ByteBuffer src) final voidonOutput()final voidprivate voidprivate voidprivate voidvoidsetSocketTimeout(Timeout timeout) Sets the socket timeout value.private intstreamData(int streamId, AtomicInteger streamOutputWindow, ByteBuffer payload) private voidstreamDataFrame(int streamId, AtomicInteger streamOutputWindow, ByteBuffer payload, int chunk) private intupdateInputWindow(int streamId, AtomicInteger window, int delta) private voidupdateLastStreamId(int streamId) private intupdateOutputWindow(int streamId, AtomicInteger window, int delta) private intupdateWindow(AtomicInteger window, int delta)
-
Field Details
-
LINGER_TIME
private static final long LINGER_TIME- See Also:
-
CONNECTION_WINDOW_LOW_MARK
private static final long CONNECTION_WINDOW_LOW_MARK- See Also:
-
ioSession
-
frameFactory
-
idGenerator
-
httpProcessor
-
localConfig
-
inputMetrics
-
outputMetrics
-
connMetrics
-
inputBuffer
-
outputBuffer
-
outputQueue
-
hPackEncoder
-
hPackDecoder
-
streamMap
-
pingHandlers
-
connInputWindow
-
connOutputWindow
-
outputRequests
-
lastStreamId
-
streamListener
-
connState
-
localSettingState
-
remoteSettingState
-
initInputWinSize
private int initInputWinSize -
initOutputWinSize
private int initOutputWinSize -
lowMark
private int lowMark -
remoteConfig
-
continuation
-
processedRemoteStreamId
private int processedRemoteStreamId -
endpointDetails
-
goAwayReceived
private boolean goAwayReceived
-
-
Constructor Details
-
AbstractH2StreamMultiplexer
AbstractH2StreamMultiplexer(ProtocolIOSession ioSession, FrameFactory frameFactory, StreamIdGenerator idGenerator, HttpProcessor httpProcessor, CharCodingConfig charCodingConfig, H2Config h2Config, H2StreamListener streamListener)
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceIdentifiable
-
acceptHeaderFrame
- Throws:
H2ConnectionException
-
acceptPushRequest
- Throws:
H2ConnectionException
-
acceptPushFrame
- Throws:
H2ConnectionException
-
createRemotelyInitiatedStream
abstract H2StreamHandler createRemotelyInitiatedStream(H2StreamChannel channel, HttpProcessor httpProcessor, BasicHttpConnectionMetrics connMetrics, HandlerFactory<AsyncPushConsumer> pushHandlerFactory) throws IOException - Throws:
IOException
-
createLocallyInitiatedStream
abstract H2StreamHandler createLocallyInitiatedStream(ExecutableCommand command, H2StreamChannel channel, HttpProcessor httpProcessor, BasicHttpConnectionMetrics connMetrics) throws IOException - Throws:
IOException
-
updateWindow
- Throws:
ArithmeticException
-
updateInputWindow
private int updateInputWindow(int streamId, AtomicInteger window, int delta) throws ArithmeticException - Throws:
ArithmeticException
-
updateOutputWindow
private int updateOutputWindow(int streamId, AtomicInteger window, int delta) throws ArithmeticException - Throws:
ArithmeticException
-
commitFrameInternal
- Throws:
IOException
-
commitFrame
- Throws:
IOException
-
commitHeaders
private void commitHeaders(int streamId, List<? extends Header> headers, boolean endStream) throws IOException - Throws:
IOException
-
commitPushPromise
private void commitPushPromise(int streamId, int promisedStreamId, List<Header> headers) throws IOException - Throws:
IOException
-
streamDataFrame
private void streamDataFrame(int streamId, AtomicInteger streamOutputWindow, ByteBuffer payload, int chunk) throws IOException - Throws:
IOException
-
streamData
private int streamData(int streamId, AtomicInteger streamOutputWindow, ByteBuffer payload) throws IOException - Throws:
IOException
-
incrementInputCapacity
private void incrementInputCapacity(int streamId, AtomicInteger inputWindow, int inputCapacity) throws IOException - Throws:
IOException
-
requestSessionOutput
private void requestSessionOutput() -
updateLastStreamId
private void updateLastStreamId(int streamId) -
generateStreamId
private int generateStreamId() -
onConnect
- Throws:
HttpExceptionIOException
-
onInput
- Throws:
HttpExceptionIOException
-
onOutput
- Throws:
HttpExceptionIOException
-
onTimeout
- Throws:
HttpExceptionIOException
-
onDisconnect
public final void onDisconnect() -
processPendingCommands
- Throws:
IOExceptionHttpException
-
onException
-
getValidStream
private AbstractH2StreamMultiplexer.H2Stream getValidStream(int streamId) throws H2ConnectionException - Throws:
H2ConnectionException
-
consumeFrame
- Throws:
HttpExceptionIOException
-
consumeDataFrame
private void consumeDataFrame(RawFrame frame, AbstractH2StreamMultiplexer.H2Stream stream) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
maximizeConnWindow
- Throws:
IOException
-
consumePushPromiseFrame
private void consumePushPromiseFrame(RawFrame frame, ByteBuffer payload, AbstractH2StreamMultiplexer.H2Stream promisedStream) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
decodeHeaders
- Throws:
HttpException
-
consumeHeaderFrame
private void consumeHeaderFrame(RawFrame frame, AbstractH2StreamMultiplexer.H2Stream stream) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
consumeContinuationFrame
private void consumeContinuationFrame(RawFrame frame, AbstractH2StreamMultiplexer.H2Stream stream) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
consumeSettingsFrame
- Throws:
HttpExceptionIOException
-
produceOutput
- Throws:
HttpExceptionIOException
-
applyRemoteSettings
- Throws:
H2ConnectionException
-
applyLocalSettings
- Throws:
H2ConnectionException
-
close
Description copied from interface:HttpConnectionCloses this connection gracefully. This method will attempt to flush the internal output buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Useshutdowninstead.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceHttpConnection- Throws:
IOException
-
close
Description copied from interface:ModalCloseableCloses this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.- Specified by:
closein interfaceModalCloseable- Parameters:
closeMode- How to close the receiver.
-
isOpen
public boolean isOpen()Description copied from interface:HttpConnectionChecks if this connection is open.- Specified by:
isOpenin interfaceHttpConnection- Returns:
- true if it is open, false if it is closed.
-
setSocketTimeout
Description copied from interface:SocketModalCloseableSets the socket timeout value.- Specified by:
setSocketTimeoutin interfaceSocketModalCloseable- Parameters:
timeout- timeout value
-
getSSLSession
Description copied from interface:HttpConnectionReturns this connection's SSL session ornullif TLS has not been activated.- Specified by:
getSSLSessionin interfaceHttpConnection- Returns:
- this connection's SSL session or
nullif TLS has not been activated.
-
getEndpointDetails
Description copied from interface:HttpConnectionReturns this connection's endpoint details.- Specified by:
getEndpointDetailsin interfaceHttpConnection- Returns:
- this connection's endpoint details.
-
getSocketTimeout
Description copied from interface:SocketModalCloseableReturns the socket timeout value.- Specified by:
getSocketTimeoutin interfaceSocketModalCloseable- Returns:
- timeout value.
-
getProtocolVersion
Description copied from interface:HttpConnectionReturns this connection's protocol version ornullif unknown.- Specified by:
getProtocolVersionin interfaceHttpConnection- Returns:
- this connection's protocol version or
nullif unknown.
-
getRemoteAddress
Description copied from interface:HttpConnectionReturns this connection's remote address ornullif it is not connected yet or unconnected.- Specified by:
getRemoteAddressin interfaceHttpConnection- Returns:
- this connection's remote address or
nullif it is not connected yet or unconnected.
-
getLocalAddress
Description copied from interface:HttpConnectionReturns this connection's local address ornullif it is not bound yet.- Specified by:
getLocalAddressin interfaceHttpConnection- Returns:
- this connection's local address or
nullif it is not bound yet.
-
appendState
-