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) 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 intprivate intprivate final FrameInputBufferprivate final BasicH2TransportMetricsprivate final ProtocolIOSessionprivate final H2Configprivate intprivate final FrameOutputBufferprivate final BasicH2TransportMetricsprivate final AtomicIntegerprivate booleanprivate final Queue<AsyncPingHandler> private H2Configprivate final H2StreamListenerprivate final H2Streams -
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) abstract booleanallowGracefulAbort(H2Stream stream) (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, H2Stream stream) private voidconsumeDataFrame(RawFrame frame, H2Stream stream) private voidconsumeFrame(RawFrame frame) private voidconsumeHeaderFrame(RawFrame frame, H2Stream stream) private voidconsumePushPromiseFrame(RawFrame frame, ByteBuffer payload, H2Stream promisedStream) private voidconsumeSettingsFrame(ByteBuffer payload) (package private) H2StreamChannelcreateChannel(int streamId) (package private) H2StreamcreateStream(H2StreamChannel channel, H2StreamHandler streamHandler) decodeHeaders(ByteBuffer payload) private voidexecutePing(PingCommand pingCommand) private voidexecutePush(PushResponseCommand pushResponseCommand) private voidexecuteRequest(RequestExecutionCommand requestExecutionCommand) private voidexecuteShutdown(ShutdownCommand shutdownCommand) private voidexecuteStaleCheck(StaleCheckCommand staleCheckCommand) (package private) abstract H2Setting[]generateSettings(H2Config localConfig) (package private) BasicHttpConnectionMetricsReturns this connection's endpoint details.(package private) HttpProcessorgetId()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.(package private) abstract H2StreamHandlerincomingPushPromise(H2StreamChannel channel, HandlerFactory<AsyncPushConsumer> pushHandlerFactory) (package private) abstract H2StreamHandlerincomingRequest(H2StreamChannel channel) private voidincrementInputCapacity(int streamId, AtomicInteger inputWindow, int inputCapacity) booleanisOpen()Checks if this connection is open.private voidmaximizeWindow(int streamId, AtomicInteger window) final voidfinal voidfinal voidonException(Exception cause) final voidonInput(ByteBuffer src) final voidonOutput()final void(package private) abstract H2StreamHandleroutgoingPushPromise(H2StreamChannel channel, AsyncPushProducer pushProducer) (package private) abstract H2StreamHandleroutgoingRequest(H2StreamChannel channel, AsyncClientExchangeHandler exchangeHandler, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context) private PriorityValueparsePriorityValue(String field) private PriorityValueparsePriorityValue(Header header) private voidprivate voidrecordPriorityFromHeaders(H2Stream stream, List<? extends Header> headers) (package private) 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) (package private) voidsubmitCommand(Command command) private intupdateInputWindow(int streamId, AtomicInteger window, int delta) private intupdateOutputWindow(int streamId, AtomicInteger window, int delta) private intupdateWindow(AtomicInteger window, int delta) private intupdateWindowMax(AtomicInteger window) (package private) abstract voidvalidateSetting(H2Param param, int value)
-
Field Details
-
CONNECTION_WINDOW_LOW_MARK
private static final long CONNECTION_WINDOW_LOW_MARK- See Also:
-
ioSession
-
frameFactory
-
httpProcessor
-
localConfig
-
inputMetrics
-
outputMetrics
-
connMetrics
-
inputBuffer
-
outputBuffer
-
outputQueue
-
hPackEncoder
-
hPackDecoder
-
streams
-
pingHandlers
-
connInputWindow
-
connOutputWindow
-
outputRequests
-
streamListener
-
connState
-
localSettingState
-
remoteSettingState
-
initInputWinSize
private int initInputWinSize -
initOutputWinSize
private int initOutputWinSize -
lowMark
private int lowMark -
remoteConfig
-
continuation
-
endpointDetails
-
goAwayReceived
private boolean goAwayReceived -
peerNoRfc7540Priorities
private volatile boolean peerNoRfc7540Priorities
-
-
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
-
getConnMetrics
BasicHttpConnectionMetrics getConnMetrics() -
getHttpProcessor
HttpProcessor getHttpProcessor() -
submitCommand
-
validateSetting
- Throws:
H2ConnectionException
-
generateSettings
-
acceptHeaderFrame
- Throws:
H2ConnectionException
-
acceptPushRequest
- Throws:
H2ConnectionException
-
acceptPushFrame
- Throws:
H2ConnectionException
-
incomingRequest
- Throws:
IOException
-
incomingPushPromise
abstract H2StreamHandler incomingPushPromise(H2StreamChannel channel, HandlerFactory<AsyncPushConsumer> pushHandlerFactory) throws IOException - Throws:
IOException
-
outgoingRequest
abstract H2StreamHandler outgoingRequest(H2StreamChannel channel, AsyncClientExchangeHandler exchangeHandler, HandlerFactory<AsyncPushConsumer> pushHandlerFactory, HttpContext context) throws IOException - Throws:
IOException
-
outgoingPushPromise
abstract H2StreamHandler outgoingPushPromise(H2StreamChannel channel, AsyncPushProducer pushProducer) throws IOException - Throws:
IOException
-
allowGracefulAbort
-
updateWindow
- Throws:
ArithmeticException
-
updateWindowMax
- 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
void requestSessionOutput() -
onConnect
- Throws:
HttpExceptionIOException
-
onInput
- Throws:
HttpExceptionIOException
-
onOutput
- Throws:
HttpExceptionIOException
-
onTimeout
- Throws:
HttpExceptionIOException
-
onDisconnect
public final void onDisconnect() -
executeShutdown
- Throws:
IOException
-
executePing
- Throws:
IOException
-
executeStaleCheck
-
executeRequest
private void executeRequest(RequestExecutionCommand requestExecutionCommand) throws IOException, HttpException - Throws:
IOExceptionHttpException
-
executePush
- Throws:
IOExceptionHttpException
-
onException
-
consumeFrame
- Throws:
HttpExceptionIOException
-
consumeDataFrame
- Throws:
HttpExceptionIOException
-
maximizeWindow
- Throws:
IOException
-
consumePushPromiseFrame
private void consumePushPromiseFrame(RawFrame frame, ByteBuffer payload, H2Stream promisedStream) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
decodeHeaders
- Throws:
HttpException
-
consumeHeaderFrame
- Throws:
HttpExceptionIOException
-
consumeContinuationFrame
private void consumeContinuationFrame(RawFrame frame, H2Stream stream) throws HttpException, IOException - Throws:
HttpExceptionIOException
-
consumeSettingsFrame
- Throws:
IOException
-
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. Useclose(CloseMode.IMMEDIATE)instead.- 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
-
createChannel
-
createStream
H2Stream createStream(H2StreamChannel channel, H2StreamHandler streamHandler) throws H2ConnectionException - Throws:
H2ConnectionException
-
recordPriorityFromHeaders
-
parsePriorityValue
-
parsePriorityValue
-