Class DelegatedIoAcceptor

    • Constructor Detail

      • DelegatedIoAcceptor

        protected DelegatedIoAcceptor()
        Creates a new instance.
    • Method Detail

      • init

        protected void init​(IoAcceptor delegate)
        Sets the delegate. This method should be invoked before any operations is requested.
      • bind

        public void bind​(java.net.SocketAddress address,
                         IoHandler handler)
                  throws java.io.IOException
        Description copied from interface: IoAcceptor
        Binds to the specified address and handles incoming connections with the specified handler.
        Specified by:
        bind in interface IoAcceptor
        Throws:
        java.io.IOException - if failed to bind
      • bind

        public void bind​(java.net.SocketAddress address,
                         IoHandler handler,
                         IoServiceConfig config)
                  throws java.io.IOException
        Description copied from interface: IoAcceptor
        Binds to the specified address and handles incoming connections with the specified handler.
        Specified by:
        bind in interface IoAcceptor
        config - the configuration
        Throws:
        java.io.IOException - if failed to bind
      • unbind

        public void unbind​(java.net.SocketAddress address)
        Description copied from interface: IoAcceptor
        Unbinds from the specified address and disconnects all clients connected there.
        Specified by:
        unbind in interface IoAcceptor
      • unbindAll

        public void unbindAll()
        Description copied from interface: IoAcceptor
        Unbinds all addresses which were bound by this acceptor.
        Specified by:
        unbindAll in interface IoAcceptor
      • isManaged

        public boolean isManaged​(java.net.SocketAddress address)
        Description copied from interface: IoService
        Returns true if this service is managing the specified serviceAddress. If this service is an IoAcceptor, serviceAddress is a bind address. If this service is an IoConnector, serviceAddress is a remote address.
        Specified by:
        isManaged in interface IoService
      • getManagedServiceAddresses

        public java.util.Set<java.net.SocketAddress> getManagedServiceAddresses()
        Description copied from interface: IoService
        Returns all SocketAddresses this service is managing. If this service is an IoAcceptor, a set of bind addresses will be returned. If this service is an IoConnector, a set of remote addresses will be returned.
        Specified by:
        getManagedServiceAddresses in interface IoService
      • getManagedSessions

        public java.util.Set<IoSession> getManagedSessions​(java.net.SocketAddress serviceAddress)
        Description copied from interface: IoService
        Returns all sessions with the specified remote or local address, which are currently managed by this service. IoAcceptor will assume the specified address is a local address, and IoConnector will assume it's a remote address.
        Specified by:
        getManagedSessions in interface IoService
        Parameters:
        serviceAddress - the address to return all sessions for.
        Returns:
        the sessions. An empty collection if there's no session.
      • newSession

        public IoSession newSession​(java.net.SocketAddress remoteAddress,
                                    java.net.SocketAddress localAddress)
        Description copied from interface: IoAcceptor
        (Optional) Returns an IoSession that is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound by IoAcceptor via IoAcceptor.bind(SocketAddress, IoHandler).

        This operation is optional. Please throw UnsupportedOperationException if the transport type doesn't support this operation. This operation is usually implemented for connectionless transport types.

        Specified by:
        newSession in interface IoAcceptor
      • getDefaultConfig

        public IoServiceConfig getDefaultConfig()
        Description copied from interface: IoService
        Returns the default configuration which is used when you didn't specify any configuration.
        Specified by:
        getDefaultConfig in interface IoService