Class ConnectionFactoryConnectorPoolImpl


  • public class ConnectionFactoryConnectorPoolImpl
    extends ConnectionFactory

    Factory for encapsulating a NioSocketConnector in such a way as to allow us to reuse the connector for each #connect(SocketAddress, SocketAddress, IoSessionInitializer, IoHandler) call.

    There will be one ConnectionFactory for each discrete connection timeout value.

    Author:
    Seth, ranger, Duncan Mackintosh
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.mina.core.future.ConnectFuture connect​(SocketAddress remoteAddress, org.apache.mina.core.session.IoSessionInitializer<? extends org.apache.mina.core.future.ConnectFuture> init, org.apache.mina.core.service.IoHandler handler)
      Connect to a remote socket.
      protected void dispose()
      Dispose of any resources that are held by the connection.
      org.apache.mina.core.future.ConnectFuture reConnect​(SocketAddress remoteAddress, org.apache.mina.core.session.IoSessionInitializer<? extends org.apache.mina.core.future.ConnectFuture> init, org.apache.mina.core.service.IoHandler handler)
      Delegates completely to #connect(SocketAddress, SocketAddress, IoSessionInitializer, IoHandler) since we are reusing the same connector for all invocations.
    • Constructor Detail

      • ConnectionFactoryConnectorPoolImpl

        protected ConnectionFactoryConnectorPoolImpl​(int timeoutInMillis)
        Create a new factory. Private because one should use ConnectionFactory.getFactory(int)
    • Method Detail

      • connect

        public org.apache.mina.core.future.ConnectFuture connect​(SocketAddress remoteAddress,
                                                                 org.apache.mina.core.session.IoSessionInitializer<? extends org.apache.mina.core.future.ConnectFuture> init,
                                                                 org.apache.mina.core.service.IoHandler handler)

        Connect to a remote socket. If org.opennms.netmgt.provision.maxConcurrentConnections is set, this may block until a connection slot is available.

        You must dispose both the ConnectionFactoryConnectorPoolImpl and ConnectFuture when done by calling #dispose(ConnectionFactoryConnectorPoolImpl, ConnectFuture).

        Specified by:
        connect in class ConnectionFactory
        Parameters:
        remoteAddress - Destination address
        init - Initialiser for the IoSession
        Returns:
        ConnectFuture from a Mina connect call
      • reConnect

        public org.apache.mina.core.future.ConnectFuture reConnect​(SocketAddress remoteAddress,
                                                                   org.apache.mina.core.session.IoSessionInitializer<? extends org.apache.mina.core.future.ConnectFuture> init,
                                                                   org.apache.mina.core.service.IoHandler handler)
        Delegates completely to #connect(SocketAddress, SocketAddress, IoSessionInitializer, IoHandler) since we are reusing the same connector for all invocations.
        Specified by:
        reConnect in class ConnectionFactory
        Parameters:
        remoteAddress -
        localAddress -
        init -
        handler -
        Returns: