Class RntbdRequestManager
- java.lang.Object
-
- com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestManager
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler
public final class RntbdRequestManager extends Object implements io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler
-
-
Constructor Summary
Constructors Constructor Description RntbdRequestManager(io.netty.channel.pool.ChannelHealthChecker healthChecker, int pendingRequestLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(io.netty.channel.ChannelHandlerContext context, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)Called once a bind operation is made.voidchannelActive(io.netty.channel.ChannelHandlerContext context)TheChannelof theChannelHandlerContextis now activevoidchannelInactive(io.netty.channel.ChannelHandlerContext context)TheChannelof theChannelHandlerContextwas registered and has reached the end of its lifetimevoidchannelRead(io.netty.channel.ChannelHandlerContext context, Object message)TheChannelof theChannelHandlerContexthas read a message from its peer.voidchannelReadComplete(io.netty.channel.ChannelHandlerContext context)TheChannelof theChannelHandlerContexthas fully consumed the most-recent message read.voidchannelRegistered(io.netty.channel.ChannelHandlerContext context)Constructs aCoalescingBufferQueuefor buffering encoded requests until we have anRntbdRequestvoidchannelUnregistered(io.netty.channel.ChannelHandlerContext context)TheChannelof theChannelHandlerContextwas unregistered from itsEventLoopvoidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext context)Gets called once the writable state of aChannelchanged.voidclose(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)Called once a close operation is made.voidconnect(io.netty.channel.ChannelHandlerContext context, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)Called once a connect operation is made.voidderegister(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)Called once a deregister operation is made from the current registeredEventLoop.voiddisconnect(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)Called once a disconnect operation is made.voidexceptionCaught(io.netty.channel.ChannelHandlerContext context, Throwable cause)ProcessesChannelHandlerContext.fireExceptionCaught(Throwable)in theChannelPipelinevoidflush(io.netty.channel.ChannelHandlerContext context)Called once a flush operation is madevoidhandlerAdded(io.netty.channel.ChannelHandlerContext context)Gets called after theChannelHandlerwas added to the actual context and it's ready to handle events.voidhandlerRemoved(io.netty.channel.ChannelHandlerContext context)Gets called after theChannelHandlerwas removed from the actual context and it doesn't handle events anymore.voidread(io.netty.channel.ChannelHandlerContext context)InterceptsChannelHandlerContext.read()voiduserEventTriggered(io.netty.channel.ChannelHandlerContext context, Object event)Processes inbound events triggered by channel handlers in theRntbdClientChannelHandlerpipelinevoidwrite(io.netty.channel.ChannelHandlerContext context, Object message, io.netty.channel.ChannelPromise promise)Called once a write operation is made
-
-
-
Method Detail
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext context)
Gets called after theChannelHandlerwas added to the actual context and it's ready to handle events.- Specified by:
handlerAddedin interfaceio.netty.channel.ChannelHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs
-
handlerRemoved
public void handlerRemoved(io.netty.channel.ChannelHandlerContext context)
Gets called after theChannelHandlerwas removed from the actual context and it doesn't handle events anymore.- Specified by:
handlerRemovedin interfaceio.netty.channel.ChannelHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext context)
TheChannelof theChannelHandlerContextis now active- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext context)
TheChannelof theChannelHandlerContextwas registered and has reached the end of its lifetimeThis method will only be called after the channel is closed.
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs
-
channelRead
public void channelRead(io.netty.channel.ChannelHandlerContext context, Object message)TheChannelof theChannelHandlerContexthas read a message from its peer.- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs.message- The message read.
-
channelReadComplete
public void channelReadComplete(io.netty.channel.ChannelHandlerContext context)
TheChannelof theChannelHandlerContexthas fully consumed the most-recent message read.If
ChannelOption.AUTO_READis off, no further attempt to read inbound data from the currentChannelwill be made untilChannelHandlerContext.read()is called. This leaves time for outbound messages to be written.- Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs
-
channelRegistered
public void channelRegistered(io.netty.channel.ChannelHandlerContext context)
Constructs aCoalescingBufferQueuefor buffering encoded requests until we have anRntbdRequestThis method then calls
ChannelHandlerContext.fireChannelRegistered()to forward to the nextChannelInboundHandlerin theChannelPipeline.Sub-classes may override this method to change behavior.
- Specified by:
channelRegisteredin interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context- theChannelHandlerContextfor which the bind operation is made
-
channelUnregistered
public void channelUnregistered(io.netty.channel.ChannelHandlerContext context)
TheChannelof theChannelHandlerContextwas unregistered from itsEventLoop- Specified by:
channelUnregisteredin interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs
-
channelWritabilityChanged
public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext context)
Gets called once the writable state of aChannelchanged. You can check the state withChannel.isWritable().- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongs
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext context, Throwable cause)ProcessesChannelHandlerContext.fireExceptionCaught(Throwable)in theChannelPipeline- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongscause- Exception caught
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext context, Object event)Processes inbound events triggered by channel handlers in theRntbdClientChannelHandlerpipelineAll but inbound request management events are ignored.
- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Parameters:
context-ChannelHandlerContextto which thisRntbdRequestManagerbelongsevent- An object representing a user event
-
bind
public void bind(io.netty.channel.ChannelHandlerContext context, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)Called once a bind operation is made.- Specified by:
bindin interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the bind operation is madelocalAddress- theSocketAddressto which it should boundpromise- theChannelPromiseto notify once the operation completes
-
close
public void close(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)Called once a close operation is made.- Specified by:
closein interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes
-
connect
public void connect(io.netty.channel.ChannelHandlerContext context, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)Called once a connect operation is made.- Specified by:
connectin interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the connect operation is maderemoteAddress- theSocketAddressto which it should connectlocalAddress- theSocketAddresswhich is used as source on connectpromise- theChannelPromiseto notify once the operation completes
-
deregister
public void deregister(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)Called once a deregister operation is made from the current registeredEventLoop.- Specified by:
deregisterin interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the deregister operation is madepromise- theChannelPromiseto notify once the operation completes
-
disconnect
public void disconnect(io.netty.channel.ChannelHandlerContext context, io.netty.channel.ChannelPromise promise)Called once a disconnect operation is made.- Specified by:
disconnectin interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the disconnect operation is madepromise- theChannelPromiseto notify once the operation completes
-
flush
public void flush(io.netty.channel.ChannelHandlerContext context)
Called once a flush operation is madeThe flush operation will try to flush out all previous written messages that are pending.
- Specified by:
flushin interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the flush operation is made
-
read
public void read(io.netty.channel.ChannelHandlerContext context)
InterceptsChannelHandlerContext.read()- Specified by:
readin interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the read operation is made
-
write
public void write(io.netty.channel.ChannelHandlerContext context, Object message, io.netty.channel.ChannelPromise promise)Called once a write operation is madeThe write operation will send messages through the
ChannelPipelinewhich are then ready to be flushed to the actualChannel. This will occur whenChannel.flush()is called.- Specified by:
writein interfaceio.netty.channel.ChannelOutboundHandler- Parameters:
context- theChannelHandlerContextfor which the write operation is mademessage- the message to writepromise- theChannelPromiseto notify once the operation completes
-
-