Class Nio2Connector
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, Closeable, IoConnector, IoService, IoServiceEventListenerManager
TODO Add javadoc
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class AbstractCloseable
AbstractCloseable.State -
Field Summary
FieldsFields inherited from class Nio2Service
CONFIGURABLE_OPTIONS, disposing, propertyResolver, sessionsFields inherited from class AbstractCloseable
closeFuture, futureLock, stateFields inherited from class AbstractLoggingBean
logFields inherited from interface IoService
DEFAULT_REUSE_ADDRESS -
Constructor Summary
ConstructorsConstructorDescriptionNio2Connector(Nio2ServiceFactory nio2ServiceFactory, PropertyResolver propertyResolver, IoHandler handler, AsynchronousChannelGroup group, ExecutorService resumeTasks) -
Method Summary
Modifier and TypeMethodDescriptionconnect(SocketAddress address, AttributeRepository context, SocketAddress localAddress) protected Nio2CompletionHandler<Void, Object> createConnectionCompletionHandler(IoConnectFuture future, AsynchronousSocketChannel socket, AttributeRepository context, PropertyResolver propertyResolver, IoHandler handler) protected Nio2SessioncreateSession(PropertyResolver propertyResolver, IoHandler handler, AsynchronousSocketChannel socket) protected AsynchronousSocketChannelopenAsynchronousSocketChannel(SocketAddress address, AsynchronousChannelGroup group) Methods inherited from class Nio2Service
dispose, getChannelGroup, getExecutorService, getInnerCloseable, getIoHandler, getIoServiceEventListener, getManagedSessions, mapSession, sessionClosed, setIoServiceEventListener, setOption, setSocketOptions, unmapSessionMethods inherited from class AbstractInnerCloseable
doCloseGracefully, doCloseImmediatelyMethods inherited from class AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListenerMethods inherited from class 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListenerMethods inherited from interface IoService
getManagedSessionsMethods inherited from interface IoServiceEventListenerManager
getIoServiceEventListener, setIoServiceEventListener
-
Field Details
-
nio2ServiceFactory
-
-
Constructor Details
-
Nio2Connector
public Nio2Connector(Nio2ServiceFactory nio2ServiceFactory, PropertyResolver propertyResolver, IoHandler handler, AsynchronousChannelGroup group, ExecutorService resumeTasks)
-
-
Method Details
-
connect
public IoConnectFuture connect(SocketAddress address, AttributeRepository context, 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 AsynchronousSocketChannel openAsynchronousSocketChannel(SocketAddress address, AsynchronousChannelGroup group) throws IOException - Throws:
IOException
-
createConnectionCompletionHandler
protected Nio2CompletionHandler<Void,Object> createConnectionCompletionHandler(IoConnectFuture future, AsynchronousSocketChannel socket, AttributeRepository context, PropertyResolver propertyResolver, IoHandler handler) -
createSession
protected Nio2Session createSession(PropertyResolver propertyResolver, IoHandler handler, AsynchronousSocketChannel socket) throws Throwable - Throws:
Throwable
-