class NioServerAccepter extends NetServerBase {

    private static final Logger logger = LoggerFactory.getLogger(NioServerAccepter.class);
    private ServerSocketChannel serverChannel;

    @Override
    public synchronized void start() {
        if (isStarted())
            return;
        super.start();
        try {
            serverChannel = ServerSocketChannel.open();
            serverChannel.socket().bind(new InetSocketAddress(getHost(), getPort()));
            serverChannel.configureBlocking(false);
            connectionManager.registerAccepter(serverChannel);
        } catch (Exception e) {
            checkBindException(e, "Failed to start protocol server accepter");
        }
    }

    @Override
    public synchronized void stop() {
        if (isStopped())
            return;
        super.stop();
        if (serverChannel != null) {
            try {
                serverChannel.close();
                serverChannel = null;
            } catch (Throwable e) {
            }
        }
    }

    @Override
    public void accept(Scheduler scheduler) {<FILL_FUNCTION_BODY>}
}

        SocketChannel channel = null;
        AsyncConnection conn = null;
        try {
            channel = serverChannel.accept();
            channel.configureBlocking(false);
            NioWritableChannel writableChannel = new NioWritableChannel(channel, null);
            conn = createConnection(writableChannel, scheduler);
        } catch (Throwable e) {
            if (conn != null) {
                removeConnection(conn);
            }
            NioEventLoop.closeChannelSilently(channel);
            // 按Ctrl+C退出时accept可能抛出异常，此时就不需要记录日志了
            if (!isStopped()) {
                logger.warn(getName() + " failed to accept connection", e);
            }
        }
    
<methods>public non-sealed void <init>() ,public com.lealone.net.AsyncConnection createConnection(com.lealone.net.WritableChannel, com.lealone.db.scheduler.Scheduler) ,public void removeConnection(com.lealone.net.AsyncConnection) ,public void setConnectionManager(com.lealone.net.AsyncConnectionManager) <variables>protected com.lealone.net.AsyncConnectionManager connectionManager