Class AbstractIoConnector

    • Method Detail

      • getConnectTimeoutCheckInterval

        public long getConnectTimeoutCheckInterval()
        Returns:
        The minimum time that this connector can have for a connection timeout in milliseconds.
      • setConnectTimeoutCheckInterval

        public void setConnectTimeoutCheckInterval​(long minimumConnectTimeout)
        Sets the timeout for the connection check
        Parameters:
        minimumConnectTimeout - The delay we wait before checking the connection
      • getConnectTimeout

        @Deprecated
        public final int getConnectTimeout()
        Deprecated.
        Take a look at getConnectTimeoutMillis()
        Specified by:
        getConnectTimeout in interface IoConnector
        Returns:
        the connect timeout in seconds. The default value is 1 minute.
      • getConnectTimeoutMillis

        public final long getConnectTimeoutMillis()
        Specified by:
        getConnectTimeoutMillis in interface IoConnector
        Returns:
        the connect timeout in milliseconds. The default value is 1 minute.
      • setConnectTimeout

        @Deprecated
        public final void setConnectTimeout​(int connectTimeout)
        Deprecated.
        Take a look at setConnectTimeoutMillis(long)
        Description copied from interface: IoConnector
        Sets the connect timeout in seconds. The default value is 1 minute.
        Specified by:
        setConnectTimeout in interface IoConnector
        Parameters:
        connectTimeout - The time out for the connection
      • setConnectTimeoutMillis

        public final void setConnectTimeoutMillis​(long connectTimeoutInMillis)
        Sets the connect timeout value in milliseconds.
        Specified by:
        setConnectTimeoutMillis in interface IoConnector
        Parameters:
        connectTimeoutInMillis - The time out for the connection
      • setDefaultLocalAddress

        public final void setDefaultLocalAddress​(SocketAddress localAddress)
        Sets the default local address
        Specified by:
        setDefaultLocalAddress in interface IoConnector
        Parameters:
        localAddress - The default local address
      • setDefaultRemoteAddress

        public final void setDefaultRemoteAddress​(SocketAddress defaultRemoteAddress)
        Sets the default remote address to connect to when no argument is specified in IoConnector.connect() method.
        Specified by:
        setDefaultRemoteAddress in interface IoConnector
        Parameters:
        defaultRemoteAddress - The default remote address
      • connect

        public final ConnectFuture connect​(SocketAddress remoteAddress)
        Connects to the specified remote address.
        Specified by:
        connect in interface IoConnector
        Parameters:
        remoteAddress - The remote address to connect to
        Returns:
        the ConnectFuture instance which is completed when the connection attempt initiated by this call succeeds or fails.
      • connect

        public ConnectFuture connect​(SocketAddress remoteAddress,
                                     IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
        Connects to the specified remote address and invokes the ioSessionInitializer when the IoSession is created but before IoHandler.sessionCreated(IoSession) is invoked. There is no guarantee that the ioSessionInitializer will be invoked before this method returns.
        Specified by:
        connect in interface IoConnector
        Parameters:
        remoteAddress - the remote address to connect to
        sessionInitializer - the callback to invoke when the IoSession object is created
        Returns:
        the ConnectFuture instance which is completed when the connection attempt initiated by this call succeeds or fails.
      • connect

        public ConnectFuture connect​(SocketAddress remoteAddress,
                                     SocketAddress localAddress)
        Connects to the specified remote address binding to the specified local address.
        Specified by:
        connect in interface IoConnector
        Parameters:
        remoteAddress - The remote address to connect
        localAddress - The local address to bind
        Returns:
        the ConnectFuture instance which is completed when the connection attempt initiated by this call succeeds or fails.
      • connect

        public final ConnectFuture connect​(SocketAddress remoteAddress,
                                           SocketAddress localAddress,
                                           IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
        Connects to the specified remote address binding to the specified local address and and invokes the ioSessionInitializer when the IoSession is created but before IoHandler.sessionCreated(IoSession) is invoked. There is no guarantee that the ioSessionInitializer will be invoked before this method returns.
        Specified by:
        connect in interface IoConnector
        Parameters:
        remoteAddress - the remote address to connect to
        localAddress - the local interface to bind to
        sessionInitializer - the callback to invoke when the IoSession object is created
        Returns:
        the ConnectFuture instance which is completed when the connection attempt initiated by this call succeeds or fails.
      • connect0

        protected abstract ConnectFuture connect0​(SocketAddress remoteAddress,
                                                  SocketAddress localAddress,
                                                  IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
        Implement this method to perform the actual connect operation.
        Parameters:
        remoteAddress - The remote address to connect from
        localAddress - null if no local address is specified
        sessionInitializer - The IoSessionInitializer to use when the connection s successful
        Returns:
        The ConnectFuture associated with this asynchronous operation
      • finishSessionInitialization0

        protected final void finishSessionInitialization0​(IoSession session,
                                                          IoFuture future)
        Adds required internal attributes and IoFutureListeners related with event notifications to the specified session and future. Do not call this method directly;
        Overrides:
        finishSessionInitialization0 in class AbstractIoService
        Parameters:
        session - The session to initialize
        future - The Future to use