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
,org.apache.sshd.common.Closeable
,org.apache.sshd.common.io.IoSession
,org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
public class NettyIoSession
extends org.apache.sshd.common.util.closeable.AbstractCloseable
implements org.apache.sshd.common.io.IoSession
The Netty based IoSession implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Netty adapter to use as a bridge, with extra handling for suspending reads.protected static class
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SocketAddress
protected final io.netty.channel.ChannelInboundHandlerAdapter
protected io.netty.channel.ChannelHandlerContext
protected final org.apache.sshd.common.io.IoHandler
protected final long
protected io.netty.channel.ChannelFuture
protected final AtomicBoolean
protected SocketAddress
protected final NettyIoService
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Constructor Summary
ConstructorsConstructorDescriptionNettyIoSession
(NettyIoService service, org.apache.sshd.common.io.IoHandler handler, SocketAddress acceptanceAddress) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
channelActive
(io.netty.channel.ChannelHandlerContext ctx) protected void
channelInactive
(io.netty.channel.ChannelHandlerContext ctx) protected void
channelRead
(io.netty.channel.ChannelHandlerContext ctx, org.apache.sshd.common.util.Readable msg) protected org.apache.sshd.common.future.CloseFuture
protected void
protected void
exceptionCaught
(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) getAttribute
(Object key) long
getId()
org.apache.sshd.common.io.IoService
removeAttribute
(Object key) void
setAttribute
(Object key, Object value) setAttributeIfAbsent
(Object key, Object value) void
void
suspend()
Intended for tests simulating a sudden connection drop only! Do not call otherwise.void
toString()
org.apache.sshd.common.io.IoWriteFuture
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, removeCloseFutureListener
Methods 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, warn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, isClosed, isClosing, isOpen, removeCloseFutureListener
Methods inherited from interface org.apache.sshd.common.io.IoSession
close
-
Field Details
-
attributes
-
service
-
handler
protected final org.apache.sshd.common.io.IoHandler 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
-
acceptanceAddress
-
-
Constructor Details
-
NettyIoSession
public NettyIoSession(NettyIoService service, org.apache.sshd.common.io.IoHandler handler, SocketAddress acceptanceAddress)
-
-
Method Details
-
getId
public long getId()- Specified by:
getId
in interfaceorg.apache.sshd.common.io.IoSession
-
getAttribute
- Specified by:
getAttribute
in interfaceorg.apache.sshd.common.io.IoSession
-
setAttribute
- Specified by:
setAttribute
in interfaceorg.apache.sshd.common.io.IoSession
-
setAttributeIfAbsent
- Specified by:
setAttributeIfAbsent
in interfaceorg.apache.sshd.common.io.IoSession
-
removeAttribute
- Specified by:
removeAttribute
in interfaceorg.apache.sshd.common.io.IoSession
-
getRemoteAddress
- Specified by:
getRemoteAddress
in interfaceorg.apache.sshd.common.util.net.ConnectionEndpointsIndicator
-
getLocalAddress
- Specified by:
getLocalAddress
in interfaceorg.apache.sshd.common.util.net.ConnectionEndpointsIndicator
-
getAcceptanceAddress
- Specified by:
getAcceptanceAddress
in interfaceorg.apache.sshd.common.io.IoSession
-
writeBuffer
public org.apache.sshd.common.io.IoWriteFuture writeBuffer(org.apache.sshd.common.util.buffer.Buffer buffer) - Specified by:
writeBuffer
in interfaceorg.apache.sshd.common.io.IoSession
-
getService
public org.apache.sshd.common.io.IoService getService()- Specified by:
getService
in interfaceorg.apache.sshd.common.io.IoSession
-
suspendRead
public void suspendRead()- Specified by:
suspendRead
in interfaceorg.apache.sshd.common.io.IoSession
-
resumeRead
public void resumeRead()- Specified by:
resumeRead
in interfaceorg.apache.sshd.common.io.IoSession
-
shutdownOutputStream
- Specified by:
shutdownOutputStream
in interfaceorg.apache.sshd.common.io.IoSession
- Throws:
IOException
-
suspend
public void suspend()Intended for tests simulating a sudden connection drop only! Do not call otherwise. -
doCloseGracefully
protected org.apache.sshd.common.future.CloseFuture doCloseGracefully()- Overrides:
doCloseGracefully
in classorg.apache.sshd.common.util.closeable.AbstractCloseable
-
doCloseImmediately
protected void doCloseImmediately()- Overrides:
doCloseImmediately
in 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
-