connection.handleWrite();
connection.doWrite();
        public void run() {            while (true) {            	                if (mShutdownRequested) {                    break;                }                int readyCount = 0;                try {                    if (ZimbraLog.ozserver.isDebugEnabled()) ZimbraLog.ozserver.debug("entering select");                    readyCount = mSelector.select();                } catch (IOException ioe) {                    ZimbraLog.ozserver.warn("OzServer IOException in select", ioe);                }                if (ZimbraLog.ozserver.isDebugEnabled()) ZimbraLog.ozserver.debug("selected readyCount=" + readyCount);                if (readyCount == 0) {                    continue;                }                                Iterator iter = mSelector.selectedKeys().iterator();                while (iter.hasNext()) {                    SelectionKey readyKey = (SelectionKey) iter.next();                    iter.remove();                    int readyKeyConnectionId = -1;                    Object readyKeyAttachment = readyKey.attachment();                    if (readyKeyAttachment != null && readyKeyAttachment instanceof OzConnectionHandler) {                        readyKeyConnectionId = ((OzConnectionHandler)readyKeyAttachment).getId();                    }                    if (!readyKey.isValid()) {                        ZimbraLog.ozserver.info("ready key cid=" + readyKeyConnectionId + " invalid hence ignored");                    }                                        if (ZimbraLog.ozserver.isDebugEnabled()) {                    	OzUtil.logSelectionKey(readyKey, readyKeyConnectionId, "ready key");                    }                                        if (readyKey.isAcceptable()) {                        if (ZimbraLog.ozserver.isDebugEnabled()) ZimbraLog.ozserver.debug("acceptable key");                        OzConnectionHandler connection = null;                        try {                            Socket newSocket = mServerSocket.accept();                            SocketChannel newChannel = newSocket.getChannel();                             newChannel.configureBlocking(false);                            connection = new OzConnectionHandler(OzServer.this, newChannel);                            ZimbraLog.ozserver.info("connected cid=" + connection.getId() + " " + newSocket);                        } catch (Exception e) {                            ZimbraLog.ozserver.warn("ignoring exception that occurred while handling acceptable key", e);                            if (connection != null) {                                connection.closeNow();                            }                        }                    }                                        if (readyKey.isReadable()) {                        OzConnectionHandler connection = null;                        try {                            connection = (OzConnectionHandler)readyKey.attachment();                            connection.handleRead();                        } catch (Exception e) {                            ZimbraLog.ozserver.warn("ignoring exception that occurred while handling readable key", e);                            connection.closeNow();                        }                    }                                        if (readyKey.isWritable()) {                        OzConnectionHandler connection = null;                        try {                            connection = (OzConnectionHandler)readyKey.attachment();                            connection.handleWrite();                        } catch (Exception e) {                            ZimbraLog.ozserver.warn("ignoring exception that occurred while handling writable key", e);                            connection.closeNow();                        }                    }                                    } /* end of ready keys loop */                if (ZimbraLog.ozserver.isDebugEnabled()) ZimbraLog.ozserver.debug("processed " + readyCount + " ready keys");                synchronized (mIoThreadTasks) {                    if (ZimbraLog.ozserver.isDebugEnabled()) ZimbraLog.ozserver.debug("running " + mIoThreadTasks.size() + " IO thread tasks");                    for (Iterator taskIter = mIoThreadTasks.iterator(); taskIter.hasNext(); taskIter.remove()) {                        Runnable task = (Runnable) taskIter.next();                        try {                            task.run();                        } catch (Exception e) {                            ZimbraLog.ozserver.warn("ignoring exception that occurred while running IO thread tasks", e);                        }                    }                }            }            assert(mShutdownRequested);            ZimbraLog.ozserver.info("shutting down thread pool");            mPooledExecutor.shutdownNow();            try {                ZimbraLog.ozserver.info("waiting for thread pool to shutdown");                mPooledExecutor.awaitTerminationAfterShutdown(10*1000);            } catch (InterruptedException ie) {                ZimbraLog.ozserver.warn("unexpected exception when waiting for shutdown");            }            ZimbraLog.ozserver.info("done waiting for thread pool to shutdown");                        try {                mSelector.close();            } catch (IOException ioe) {                ZimbraLog.ozserver.warn("unexpected exception when closing selector");            }            ZimbraLog.ozserver.info("closed selector");        }