public void bind(SocketAddress address, IoHandler handler,
            IoServiceConfig config) throws IOException {
        if (handler == null) {
            throw new NullPointerException("handler");
        }

        if (address != null && !(address instanceof InetSocketAddress)) {
            throw new IllegalArgumentException("Unexpected address type: "
                    + address.getClass());
        }

        if (config == null) {
            config = getDefaultConfig();
        }

        RegistrationRequest request = new RegistrationRequest(address, handler,
                config);

        synchronized (lock) {
            startupWorker();
    
            registerQueue.add(request);
    
            selector.wakeup();
        }

        try {
            request.done.await();
        } catch (InterruptedException e) {
            ExceptionMonitor.getInstance().exceptionCaught(e);
        }

        if (request.exception != null) {
            throw request.exception;
        }
    }