Class CloseHandler
- java.lang.Object
-
- io.servicetalk.transport.netty.internal.CloseHandler
-
public abstract class CloseHandler extends java.lang.ObjectContract between protocol codecs and a close handler.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCloseHandler.CloseEventThese events indicate an event was observed from the protocol orChannelthat indicates the end of theChanneland no further requests should be attempted.static classCloseHandler.CloseEventObservedExceptionClosedChannelExceptionwith additional meta-data to provide more context on what side initiated the close event.static classCloseHandler.DiscardFurtherInboundEventNetty UserEvent to indicate the further inbound data should be discarded.
-
Field Summary
Fields Modifier and Type Field Description static CloseHandlerUNSUPPORTED_PROTOCOL_CLOSE_HANDLER
-
Constructor Summary
Constructors Constructor Description CloseHandler()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static CloseHandlerforNonPipelined(boolean isClient, io.netty.channel.ChannelConfig config)Create a newCloseHandlerinstance which doesn't support pipelining, and only ever has a single outstanding request/response.static CloseHandlerforPipelinedRequestResponse(boolean client, io.netty.channel.ChannelConfig config)NewCloseHandlerinstance.abstract voidprotocolClosingInbound(io.netty.channel.ChannelHandlerContext ctx)Signal inbound close command observed, to be emitted from theEventLoopfor theChannel.abstract voidprotocolClosingOutbound(io.netty.channel.ChannelHandlerContext ctx)Signal outbound close command observed, to be emitted from theEventLoopfor theChannel.abstract voidprotocolPayloadBeginInbound(io.netty.channel.ChannelHandlerContext ctx)Signal begin of inbound payload, to be emitted from theEventLoopfor theChannel.abstract voidprotocolPayloadBeginOutbound(io.netty.channel.ChannelHandlerContext ctx)Signal begin of outbound payload, to be emitted from theEventLoopfor theChannel.abstract voidprotocolPayloadEndInbound(io.netty.channel.ChannelHandlerContext ctx)Signal end of inbound payload, to be emitted from theEventLoopfor theChannel.abstract voidprotocolPayloadEndOutbound(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)Signal end of outbound payload, including theChannelPromiseassociated with the last write.
-
-
-
Field Detail
-
UNSUPPORTED_PROTOCOL_CLOSE_HANDLER
public static final CloseHandler UNSUPPORTED_PROTOCOL_CLOSE_HANDLER
-
-
Method Detail
-
forPipelinedRequestResponse
public static CloseHandler forPipelinedRequestResponse(boolean client, io.netty.channel.ChannelConfig config)
NewCloseHandlerinstance.- Parameters:
client- operation mode,TRUEforclientorFALSEforserverconfig- TheChannelConfigassociated with the channel to create theCloseHandlerfor. ThisChannelConfigmaybe modified to ensure the underlying options allow for half-closure.- Returns:
- a new connection close handler with behavior for a pipelined request/response client or server
-
forNonPipelined
public static CloseHandler forNonPipelined(boolean isClient, io.netty.channel.ChannelConfig config)
Create a newCloseHandlerinstance which doesn't support pipelining, and only ever has a single outstanding request/response. TheCloseHandlerdoesn't require the channel be of any special type (e.g.DuplexChannel) nor support any special channel options (e.g.ChannelOption.ALLOW_HALF_CLOSURE).- Parameters:
isClient- operation mode,TRUEforclientorFALSEforserver.config- TheChannelConfigassociated with the channel to create theCloseHandlerfor.- Returns:
- a new
CloseHandlerinstance which doesn't support pipelining.
-
protocolPayloadBeginInbound
public abstract void protocolPayloadBeginInbound(io.netty.channel.ChannelHandlerContext ctx)
Signal begin of inbound payload, to be emitted from theEventLoopfor theChannel.- Parameters:
ctx-ChannelHandlerContext
-
protocolPayloadEndInbound
public abstract void protocolPayloadEndInbound(io.netty.channel.ChannelHandlerContext ctx)
Signal end of inbound payload, to be emitted from theEventLoopfor theChannel.- Parameters:
ctx-ChannelHandlerContext
-
protocolPayloadBeginOutbound
public abstract void protocolPayloadBeginOutbound(io.netty.channel.ChannelHandlerContext ctx)
Signal begin of outbound payload, to be emitted from theEventLoopfor theChannel.- Parameters:
ctx-ChannelHandlerContext
-
protocolPayloadEndOutbound
public abstract void protocolPayloadEndOutbound(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)Signal end of outbound payload, including theChannelPromiseassociated with the last write. Must be called from theEventLoopfor theChannel.- Parameters:
promise- TheChannelPromiseassociated with the last write operation.ctx-ChannelHandlerContext
-
protocolClosingInbound
public abstract void protocolClosingInbound(io.netty.channel.ChannelHandlerContext ctx)
Signal inbound close command observed, to be emitted from theEventLoopfor theChannel.- Parameters:
ctx-ChannelHandlerContext
-
protocolClosingOutbound
public abstract void protocolClosingOutbound(io.netty.channel.ChannelHandlerContext ctx)
Signal outbound close command observed, to be emitted from theEventLoopfor theChannel.- Parameters:
ctx-ChannelHandlerContext
-
-