Package org.apache.sshd.netty
Class NettyIoSession
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.util.closeable.IoBaseCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.netty.NettyIoSession
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,Closeable,IoSession,org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
public class NettyIoSession
extends org.apache.sshd.common.util.closeable.AbstractCloseable
implements IoSession
The Netty based IoSession implementation.
- Author:
- Julien Viet, Apache MINA SSHD Project
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classNetty adapter to use as a bridge, with extra handling for suspending reads.protected static classNested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.netty.channel.ChannelInboundHandlerAdapterprotected io.netty.channel.ChannelHandlerContextprotected final IoHandlerprotected final longprotected io.netty.channel.ChannelFutureprotected final AtomicBooleanprotected SocketAddressprotected final NettyIoServiceFields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, stateFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionNettyIoSession(NettyIoService service, IoHandler handler, SocketAddress acceptanceAddress) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidchannelActive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, org.apache.sshd.common.util.Readable msg) protected CloseFutureprotected voidprotected voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) getAttribute(Object key) longgetId()removeAttribute(Object key) voidsetAttribute(Object key, Object value) setAttributeIfAbsent(Object key, Object value) voidvoidsuspend()Intended for tests simulating a sudden connection drop only!voidtoString()writeBuffer(org.apache.sshd.common.util.buffer.Buffer buffer) Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListenerMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Field Details
-
attributes
-
service
-
handler
-
id
protected final long id -
context
protected volatile io.netty.channel.ChannelHandlerContext context -
remoteAddr
-
prev
protected io.netty.channel.ChannelFuture prev -
adapter
protected final io.netty.channel.ChannelInboundHandlerAdapter adapter -
readSuspended
-
-
Constructor Details
-
NettyIoSession
-
-
Method Details
-
getId
public long getId() -
getAttribute
- Specified by:
getAttributein interfaceIoSession
-
setAttribute
- Specified by:
setAttributein interfaceIoSession
-
setAttributeIfAbsent
- Specified by:
setAttributeIfAbsentin interfaceIoSession
-
removeAttribute
- Specified by:
removeAttributein interfaceIoSession
-
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceorg.apache.sshd.common.util.net.ConnectionEndpointsIndicator
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceorg.apache.sshd.common.util.net.ConnectionEndpointsIndicator
-
getAcceptanceAddress
- Specified by:
getAcceptanceAddressin interfaceIoSession
-
writeBuffer
- Specified by:
writeBufferin interfaceIoSession
-
getService
- Specified by:
getServicein interfaceIoSession
-
suspendRead
public void suspendRead()- Specified by:
suspendReadin interfaceIoSession
-
resumeRead
public void resumeRead()- Specified by:
resumeReadin interfaceIoSession
-
shutdownOutputStream
- Specified by:
shutdownOutputStreamin interfaceIoSession- Throws:
IOException
-
suspend
public void suspend()Intended for tests simulating a sudden connection drop only! Do not call otherwise. -
doCloseGracefully
- Overrides:
doCloseGracefullyin classorg.apache.sshd.common.util.closeable.AbstractCloseable
-
doCloseImmediately
protected void doCloseImmediately()- Overrides:
doCloseImmediatelyin classorg.apache.sshd.common.util.closeable.AbstractCloseable
-
channelActive
- Throws:
Exception
-
channelInactive
- Throws:
Exception
-
channelRead
protected void channelRead(io.netty.channel.ChannelHandlerContext ctx, org.apache.sshd.common.util.Readable msg) throws Exception - Throws:
Exception
-
exceptionCaught
protected void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Throws:
Exception
-
toString
-