if (isDebugEnabled) ZimbraLog.ozserver.debug("not all handled, compacting "  + (mReadBuffer.position() - handledBytes) + " bytes");
if (ZimbraLog.ozserver.isDebugEnabled()) ZimbraLog.ozserver.debug("not all handled, compacting "  + (mReadBuffer.position() - handledBytes) + " bytes");
    private void read() throws IOException {    	boolean isDebugEnabled = ZimbraLog.ozserver.isDebugEnabled();         // This method runs in the IOThread.  Note that we disable read interest here, and        // not in the worker thread, so that we don't get another ready notification        // before the worker has had a chance to disable the read interest.                if (isDebugEnabled) {             ZimbraLog.ozserver.debug(OzUtil.byteBufferToString("cid=" + mId + " read buffer at start", mReadBuffer, true));        }                int bytesRead = mChannel.read(mReadBuffer);                if (isDebugEnabled) {             ZimbraLog.ozserver.debug(OzUtil.byteBufferToString("cid=" + mId + " read buffer after read", mReadBuffer, true));        }                assert(bytesRead == mReadBuffer.position());                if (mServer.getSnooper().snoopReads()) {            mServer.getSnooper().read(this, bytesRead, mReadBuffer);        }                if (bytesRead == -1) {            ZimbraLog.ozserver.info("cid=" + mId + " client closed channel " + mChannel);            mServer.execute(mHandleDisconnectTask);            return;        }                if (bytesRead == 0) {            ZimbraLog.ozserver.warn("cid=" + mId + " got 0 bytes on supposedly read ready channel " + mChannel);            return;        }        int handledBytes = 0;                // Create a copy which we can trash... (this does not copy underlying buffer)        ByteBuffer matchBuffer = mReadBuffer.duplicate();        matchBuffer.flip();                // We may have read more than one PDU         while (matchBuffer.position() < matchBuffer.limit()) {            int matchStart = matchBuffer.position();                        if (ZimbraLog.ozserver.isDebugEnabled()) {                ZimbraLog.ozserver.debug(OzUtil.byteBufferToString("cid=" + mId + " matching", matchBuffer, false));            }                        int matchEnd = mMatcher.match(matchBuffer);                        if (isDebugEnabled) ZimbraLog.ozserver.debug("cid=" + mId + " match returned " + matchEnd);                        if (matchEnd == -1) {                break;            }                        ByteBuffer pdu = mReadBuffer.duplicate();            pdu.position(matchStart);            pdu.limit(matchBuffer.position());            mMatcher.trim(pdu);            if (mServer.getSnooper().snoopInputs()) {                mServer.getSnooper().input(this, pdu, true);            }            mProtocolHandler.handleInput(this, pdu, true);            handledBytes = matchEnd;        }                if (handledBytes == 0) {            if (isDebugEnabled) ZimbraLog.ozserver.debug("no bytes handled and no match");            if (mReadBuffer.hasRemaining()) {                if (isDebugEnabled) ZimbraLog.ozserver.debug("no bytes handled, no match, but there is room in buffer");            } else {                if (isDebugEnabled) ZimbraLog.ozserver.debug("no bytes handled, no match, and buffer is full, overflowing");                assert(mReadBuffer.limit() == mReadBuffer.position());                assert(mReadBuffer.limit() == mReadBuffer.capacity());                mReadBuffer.flip();                if (mServer.getSnooper().snoopInputs()) {                    mServer.getSnooper().input(this, mReadBuffer, false);                }                mProtocolHandler.handleInput(this, mReadBuffer, false);                mReadBuffer.clear();            }        } else {            if (mReadBuffer.position() == handledBytes) {                if (isDebugEnabled) ZimbraLog.ozserver.debug("handled all bytes in input, clearing buffer (no compacting)");                mReadBuffer.clear();            } else {                if (isDebugEnabled) ZimbraLog.ozserver.debug("not all handled, compacting "  + (mReadBuffer.position() - handledBytes) + " bytes");                mReadBuffer.position(handledBytes);                mReadBuffer.compact();            }        }        if (mChannel.isOpen()) {            enableReadInterest();        }        return;    }