-
- All Known Implementing Classes:
Http2ConnectionHandler,Http2FrameCodec,HttpToHttp2ConnectionHandler
@UnstableApi public interface Http2LifecycleManager
Manager for the life cycle of the HTTP/2 connection. Handles graceful shutdown of the channel, closing only after all of the streams have closed.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcloseStream(Http2Stream stream, Future<Void> future)Closes and deactivates the givenstream.voidcloseStreamLocal(Http2Stream stream, Future<Void> future)Closes the local side of thestream.voidcloseStreamRemote(Http2Stream stream, Future<Void> future)Closes the remote side of thestream.Future<Void>goAway(ChannelHandlerContext ctx, int lastStreamId, long errorCode, Buffer debugData)Prevents the peer from creating streams and close the connection iferrorCodeis notHttp2Error.NO_ERROR.voidonError(ChannelHandlerContext ctx, boolean outbound, Throwable cause)Processes the given error.Future<Void>resetStream(ChannelHandlerContext ctx, int streamId, long errorCode)Ensure the stream identified bystreamIdis reset.
-
-
-
Method Detail
-
closeStreamLocal
void closeStreamLocal(Http2Stream stream, Future<Void> future)
Closes the local side of thestream. Depending on thestreamstate this may result instreambeing closed. SeecloseStream(Http2Stream, Future).- Parameters:
stream- the stream to be half closed.future- SeecloseStream(Http2Stream, Future).
-
closeStreamRemote
void closeStreamRemote(Http2Stream stream, Future<Void> future)
Closes the remote side of thestream. Depending on thestreamstate this may result instreambeing closed. SeecloseStream(Http2Stream, Future).- Parameters:
stream- the stream to be half closed.future- SeecloseStream(Http2Stream, Future).
-
closeStream
void closeStream(Http2Stream stream, Future<Void> future)
Closes and deactivates the givenstream. A listener is also attached tofutureand upon completion the underlying channel will be closed ifHttp2Connection.numActiveStreams()is 0.- Parameters:
stream- the stream to be closed and deactivated.future- when completed ifHttp2Connection.numActiveStreams()is 0 then the underlying channel will be closed.
-
resetStream
Future<Void> resetStream(ChannelHandlerContext ctx, int streamId, long errorCode)
Ensure the stream identified bystreamIdis reset. If our local state does not indicate the stream has been reset yet then aRST_STREAMwill be sent to the peer. If our local state indicates the stream has already been reset then the return status will indicate success without sending anything to the peer.- Parameters:
ctx- The context used for communication and buffer allocation if necessary.streamId- The identifier of the stream to reset.errorCode- Justification as to why this stream is being reset. SeeHttp2Error.- Returns:
- Will be considered successful when the connection and stream state has been updated, and a
RST_STREAMframe has been sent to the peer. If the stream state has already been updated and aRST_STREAMframe has been sent then the return status may indicate success immediately.
-
goAway
Future<Void> goAway(ChannelHandlerContext ctx, int lastStreamId, long errorCode, Buffer debugData)
Prevents the peer from creating streams and close the connection iferrorCodeis notHttp2Error.NO_ERROR. After this call the peer is not allowed to create any new streams and the local endpoint will be limited to creating streams withstream identifier <= lastStreamId. This may result in sending aGO_AWAYframe (assuming we have not already sent one withLast-Stream-ID <= lastStreamId), or may just return success if aGO_AWAYhas previously been sent.- Parameters:
ctx- The context used for communication and buffer allocation if necessary.lastStreamId- The last stream that the local endpoint is claiming it will accept.errorCode- The rational as to why the connection is being closed. SeeHttp2Error.debugData- For diagnostic purposes (carries no semantic value).- Returns:
- Will be considered successful when the connection and stream state has been updated, and a
GO_AWAYframe has been sent to the peer. If the stream state has already been updated and aGO_AWAYframe has been sent then the return status may indicate success immediately.
-
onError
void onError(ChannelHandlerContext ctx, boolean outbound, Throwable cause)
Processes the given error.- Parameters:
ctx- The context used for communication and buffer allocation if necessary.outbound-trueif the error was caused by an outbound operation and so the correspondingPromisewas failed as well.cause- the error.
-
-