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,IoConnector,IoService,IoServiceEventListenerManager
public class Nio2Connector extends Nio2Service implements IoConnector
TODO Add javadoc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classNio2Connector.ConnectionCompletionHandler-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
-
Field Summary
Fields Modifier and Type Field Description private Nio2ServiceFactorynio2ServiceFactory-
Fields inherited from class org.apache.sshd.common.io.nio2.Nio2Service
CONFIGURABLE_OPTIONS, disposing, propertyResolver, 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(Nio2ServiceFactory nio2ServiceFactory, PropertyResolver propertyResolver, IoHandler handler, java.nio.channels.AsynchronousChannelGroup group, java.util.concurrent.ExecutorService resumeTasks)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IoConnectFutureconnect(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, PropertyResolver propertyResolver, IoHandler handler)protected Nio2SessioncreateSession(PropertyResolver propertyResolver, IoHandler handler, java.nio.channels.AsynchronousSocketChannel socket)protected java.nio.channels.AsynchronousSocketChannelopenAsynchronousSocketChannel(java.net.SocketAddress address, java.nio.channels.AsynchronousChannelGroup group)-
Methods inherited from class org.apache.sshd.common.io.nio2.Nio2Service
dispose, getChannelGroup, getExecutorService, getInnerCloseable, getIoHandler, getIoServiceEventListener, getManagedSessions, mapSession, 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
-
-
-
-
Field Detail
-
nio2ServiceFactory
private final Nio2ServiceFactory nio2ServiceFactory
-
-
Constructor Detail
-
Nio2Connector
public Nio2Connector(Nio2ServiceFactory nio2ServiceFactory, PropertyResolver propertyResolver, IoHandler handler, java.nio.channels.AsynchronousChannelGroup group, java.util.concurrent.ExecutorService resumeTasks)
-
-
Method Detail
-
connect
public IoConnectFuture connect(java.net.SocketAddress address, AttributeRepository context, java.net.SocketAddress localAddress)
- Specified by:
connectin 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 - ifnullan automatic ephemeral port and bind address is used- Returns:
- The
futurerepresenting 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, PropertyResolver propertyResolver, IoHandler handler)
-
createSession
protected Nio2Session createSession(PropertyResolver propertyResolver, IoHandler handler, java.nio.channels.AsynchronousSocketChannel socket) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
-