boolean hasNot = mChanges.hasNotifications(); int conLast = conn.getLastKnownSeqNo();
boolean notifying = mChanges.hasNotifications(); int lastSeqNo = conn.getLastKnownSeqNo();
    public synchronized RegisterNotificationResult registerNotificationConnection(OzNotificationConnectionHandler conn) throws ServiceException {        if (mPushChannel != null) {            mPushChannel.close();            mPushChannel = null;        }                if (!mNotify)            return RegisterNotificationResult.NO_NOTIFY;                Mailbox mbox = Mailbox.getMailboxByAccountId(mAccountId);                // must lock the Mailbox before locking the Session to avoid deadlock        //   because ToXML functions can now call back into the Mailbox        synchronized (mbox) {            synchronized (this) {                                // are there any notifications already pending given the passed-in seqno?                boolean hasNot = mChanges.hasNotifications();                int conLast = conn.getLastKnownSeqNo();                boolean isEmpty = mSentChanges.isEmpty();                if (hasNot || ((mChanges.getSeqNo() > conLast+1) && (!isEmpty)))                 {                    // yes!                    Element e = new Element.XMLElement("notify");                    putNotifications(conn.getZimbraContext(),e, conn.getLastKnownSeqNo());                    try {                        conn.writeHttpResponse(200, "OK", "text/xml", e.toUTF8());                        return RegisterNotificationResult.SENT_DATA;                    } catch (IOException ex) {                        throw ServiceException.FAILURE("IOException writing HTTP response to stream "+ex, ex);                    }                } else {                    mPushChannel = conn;                    return RegisterNotificationResult.WAITING;                }            }        }    }