private boolean checkPending(Message msg) {
        boolean busy = false;
        int size = msg.getApproxSize();

        if (doAccounting()) {
            synchronized (this) {
                busy = (maxPendingCount > 0 && pendingCount >= maxPendingCount);
                if (!busy) {
                    pendingCount++;
                    pendingSize += size;
                }
            }
        }
        if (busy) {
            return false;
        }
        msg.setContext(size);
        msg.pushHandler(this);
        return true;
    }
<p>This method handles choking input data so that message bus does not
blindly accept everything. This prevents an application running
out-of-memory in case it fail to choke input data itself. If this method
returns false, it means that it should be rejected.</p>

@param msg The message to count.
@return True if the message was accepted.
messagebus/src/main/java/com/yahoo/messagebus/MessageBus.java