private void dropMessage(AddressedTuple tuple, JCQueue queue) { ++dropCount; queue.recordMsgDrop(); LOG.warn( "Dropping message as overflow threshold has reached for Q = {}. OverflowCount = {}. Total Drop Count= {}, Dropped Message : {}", queue.getName(), queue.getOverflowCount(), dropCount, tuple); }
/** * Blocking call - Does not return until at least 1 element is drained or Thread.interrupt() is received. Uses backpressure wait * strategy. */ @Override public void flush() throws InterruptedException { if (currentBatch.isEmpty()) { return; } int publishCount = q.tryPublishInternal(currentBatch); int retryCount = 0; while (publishCount == 0) { // retry till at least 1 element is drained q.metrics.notifyInsertFailure(); if (retryCount == 0) { // check avoids multiple log msgs when in a idle loop LOG.debug("Experiencing Back Pressure when flushing batch to Q: {}. Entering BackPressure Wait.", q.getName()); } retryCount = q.backPressureWaitStrategy.idle(retryCount); if (Thread.interrupted()) { throw new InterruptedException(); } publishCount = q.tryPublishInternal(currentBatch); } currentBatch.subList(0, publishCount).clear(); }
/** * Blocking call, that can be interrupted via Thread.interrupt */ @Override public void publish(Object obj) throws InterruptedException { boolean inserted = q.tryPublishInternal(obj); int idleCount = 0; while (!inserted) { q.metrics.notifyInsertFailure(); if (idleCount == 0) { // check avoids multiple log msgs when in a idle loop LOG.debug("Experiencing Back Pressure on recvQueue: '{}'. Entering BackPressure Wait", q.getName()); } idleCount = q.backPressureWaitStrategy.idle(idleCount); if (Thread.interrupted()) { throw new InterruptedException(); } inserted = q.tryPublishInternal(obj); } }