Package org.apache.sshd.common.io.nio2
Class Nio2Connector
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,Closeable
,FactoryManagerHolder
,IoConnector
,IoService
,IoServiceEventListenerManager
public class Nio2Connector extends Nio2Service implements IoConnector
TODO Add javadoc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Nio2Connector.ConnectionCompletionHandler
static class
Nio2Connector.DefaultIoConnectFuture
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
-
Field Summary
-
Fields inherited from class org.apache.sshd.common.io.nio2.Nio2Service
CONFIGURABLE_OPTIONS, disposing, sessions
-
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
-
Fields inherited from interface org.apache.sshd.common.io.IoService
DEFAULT_REUSE_ADDRESS
-
-
Constructor Summary
Constructors Constructor Description Nio2Connector(FactoryManager manager, IoHandler handler, java.nio.channels.AsynchronousChannelGroup group)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IoConnectFuture
connect(java.net.SocketAddress address, AttributeRepository context, java.net.SocketAddress localAddress)
protected Nio2CompletionHandler<java.lang.Void,java.lang.Object>
createConnectionCompletionHandler(IoConnectFuture future, java.nio.channels.AsynchronousSocketChannel socket, AttributeRepository context, FactoryManager manager, IoHandler handler)
protected Nio2Session
createSession(FactoryManager manager, IoHandler handler, java.nio.channels.AsynchronousSocketChannel socket)
protected java.nio.channels.AsynchronousSocketChannel
openAsynchronousSocketChannel(java.net.SocketAddress address, java.nio.channels.AsynchronousChannelGroup group)
-
Methods inherited from class org.apache.sshd.common.io.nio2.Nio2Service
dispose, getChannelGroup, getFactoryManager, getInnerCloseable, getIoHandler, getIoServiceEventListener, getManagedSessions, sessionClosed, setIoServiceEventListener, setOption, setSocketOptions, unmapSession
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately
-
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, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.io.IoService
getManagedSessions
-
Methods inherited from interface org.apache.sshd.common.io.IoServiceEventListenerManager
getIoServiceEventListener, setIoServiceEventListener
-
-
-
-
Constructor Detail
-
Nio2Connector
public Nio2Connector(FactoryManager manager, IoHandler handler, java.nio.channels.AsynchronousChannelGroup group)
-
-
Method Detail
-
connect
public IoConnectFuture connect(java.net.SocketAddress address, AttributeRepository context, java.net.SocketAddress localAddress)
- Specified by:
connect
in interfaceIoConnector
- Parameters:
address
- The target address to connect tocontext
- An optional "context" to be attached to the established session if successfully connectedlocalAddress
- The local address to use - ifnull
an automatic ephemeral port and bind address is used- Returns:
- The
future
representing the connection request
-
openAsynchronousSocketChannel
protected java.nio.channels.AsynchronousSocketChannel openAsynchronousSocketChannel(java.net.SocketAddress address, java.nio.channels.AsynchronousChannelGroup group) throws java.io.IOException
- Throws:
java.io.IOException
-
createConnectionCompletionHandler
protected Nio2CompletionHandler<java.lang.Void,java.lang.Object> createConnectionCompletionHandler(IoConnectFuture future, java.nio.channels.AsynchronousSocketChannel socket, AttributeRepository context, FactoryManager manager, IoHandler handler)
-
createSession
protected Nio2Session createSession(FactoryManager manager, IoHandler handler, java.nio.channels.AsynchronousSocketChannel socket) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
-