Class NettyIoSession.Adapter
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.apache.sshd.netty.NettyIoSession.Adapter
- All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
- Enclosing class:
NettyIoSession
protected class NettyIoSession.Adapter
extends io.netty.channel.ChannelInboundHandlerAdapter
Netty adapter to use as a bridge, with extra handling for suspending reads. Netty may sometimes may deliver read
events even after reads have been suspended. Suspending reads only removes the channel for OP_READ in the next
select. But Netty's default read buffer management does not account for this, and it may deliver more events
still if there are more than 64kB available on the socket.
There is a FlowControlHandler that should be able to handle this case if inserted
in the channel pipeline before this handler. But somehow this did not work reliably. Therefore this adapter
manages this directly by accumulating all read events in a single buffer and delivering the whole buffer once the
low-level socket read is completed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
buffer
private org.apache.sshd.common.util.buffer.ByteArrayBuffer buffer -
ioBuffer
private io.netty.buffer.ByteBuf ioBuffer
-
-
Constructor Details
-
Adapter
public Adapter()
-
-
Method Details
-
channelActive
-
channelInactive
-
channelRead
-
channelReadComplete
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-