private void abortAllQualifiedSlowConsumers() { HashMap<Subscription, SlowConsumerEntry> toAbort = new HashMap<Subscription, SlowConsumerEntry>(); for (Entry<Subscription, SlowConsumerEntry> entry : slowConsumers.entrySet()) { if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() >= getMaxSlowDuration()) || getMaxSlowCount() > 0 && entry.getValue().slowCount >= getMaxSlowCount()) { LOG.trace("Transferring consumer{} to the abort list: {} slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().getSlowCount() }); toAbort.put(entry.getKey(), entry.getValue()); slowConsumers.remove(entry.getKey()); } else { LOG.trace("Not yet time to abort consumer {}: slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().slowCount }); } } // Now if any subscriptions made it into the aborts list we can kick them. abortSubscription(toAbort, isAbortConnection()); }
if (getMaxSlowDuration() > 0) {
private void abortAllQualifiedSlowConsumers() { HashMap<Subscription, SlowConsumerEntry> toAbort = new HashMap<Subscription, SlowConsumerEntry>(); for (Entry<Subscription, SlowConsumerEntry> entry : slowConsumers.entrySet()) { if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() >= getMaxSlowDuration()) || getMaxSlowCount() > 0 && entry.getValue().slowCount >= getMaxSlowCount()) { LOG.trace("Transferring consumer{} to the abort list: {} slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().getSlowCount() }); toAbort.put(entry.getKey(), entry.getValue()); slowConsumers.remove(entry.getKey()); } else { LOG.trace("Not yet time to abort consumer {}: slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().slowCount }); } } // Now if any subscriptions made it into the aborts list we can kick them. abortSubscription(toAbort, isAbortConnection()); }
private void abortAllQualifiedSlowConsumers() { HashMap<Subscription, SlowConsumerEntry> toAbort = new HashMap<Subscription, SlowConsumerEntry>(); for (Entry<Subscription, SlowConsumerEntry> entry : slowConsumers.entrySet()) { if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() >= getMaxSlowDuration()) || getMaxSlowCount() > 0 && entry.getValue().slowCount >= getMaxSlowCount()) { LOG.trace("Transferring consumer{} to the abort list: {} slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().getSlowCount() }); toAbort.put(entry.getKey(), entry.getValue()); slowConsumers.remove(entry.getKey()); } else { LOG.trace("Not yet time to abort consumer {}: slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().slowCount }); } } // Now if any subscriptions made it into the aborts list we can kick them. abortSubscription(toAbort, isAbortConnection()); }
private void abortAllQualifiedSlowConsumers() { HashMap<Subscription, SlowConsumerEntry> toAbort = new HashMap<Subscription, SlowConsumerEntry>(); for (Entry<Subscription, SlowConsumerEntry> entry : slowConsumers.entrySet()) { if (getMaxSlowDuration() > 0 && (entry.getValue().markCount * getCheckPeriod() >= getMaxSlowDuration()) || getMaxSlowCount() > 0 && entry.getValue().slowCount >= getMaxSlowCount()) { LOG.trace("Transferring consumer{} to the abort list: {} slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().getSlowCount() }); toAbort.put(entry.getKey(), entry.getValue()); slowConsumers.remove(entry.getKey()); } else { LOG.trace("Not yet time to abort consumer {}: slow duration = {}, slow count = {}", new Object[]{ entry.getKey().getConsumerInfo().getConsumerId(), entry.getValue().markCount * getCheckPeriod(), entry.getValue().slowCount }); } } // Now if any subscriptions made it into the aborts list we can kick them. abortSubscription(toAbort, isAbortConnection()); }
@Override public void run() { if (maxTimeSinceLastAck < 0) { // nothing to do LOG.info("no limit set, slowConsumer strategy has nothing to do"); return; } if (getMaxSlowDuration() > 0) { // For subscriptions that are already slow we mark them again and check below if // they've exceeded their configured lifetime. for (SlowConsumerEntry entry : slowConsumers.values()) { entry.mark(); } } List<Destination> disposed = new ArrayList<Destination>(); for (Destination destination : destinations.values()) { if (destination.isDisposed()) { disposed.add(destination); continue; } // Not explicitly documented but this returns a stable copy. List<Subscription> subscribers = destination.getConsumers(); updateSlowConsumersList(subscribers); } // Clean up an disposed destinations to save space. for (Destination destination : disposed) { destinations.remove(destination.getName()); } abortAllQualifiedSlowConsumers(); }
@Override public void run() { if (maxTimeSinceLastAck < 0) { // nothing to do LOG.info("no limit set, slowConsumer strategy has nothing to do"); return; } if (getMaxSlowDuration() > 0) { // For subscriptions that are already slow we mark them again and check below if // they've exceeded their configured lifetime. for (SlowConsumerEntry entry : slowConsumers.values()) { entry.mark(); } } List<Destination> disposed = new ArrayList<Destination>(); for (Destination destination : destinations.values()) { if (destination.isDisposed()) { disposed.add(destination); continue; } // Not explicitly documented but this returns a stable copy. List<Subscription> subscribers = destination.getConsumers(); updateSlowConsumersList(subscribers); } // Clean up an disposed destinations to save space. for (Destination destination : disposed) { destinations.remove(destination.getName()); } abortAllQualifiedSlowConsumers(); }
@Override public void run() { if (maxTimeSinceLastAck < 0) { // nothing to do LOG.info("no limit set, slowConsumer strategy has nothing to do"); return; } if (getMaxSlowDuration() > 0) { // For subscriptions that are already slow we mark them again and check below if // they've exceeded their configured lifetime. for (SlowConsumerEntry entry : slowConsumers.values()) { entry.mark(); } } List<Destination> disposed = new ArrayList<Destination>(); for (Destination destination : destinations.values()) { if (destination.isDisposed()) { disposed.add(destination); continue; } // Not explicitly documented but this returns a stable copy. List<Subscription> subscribers = destination.getConsumers(); updateSlowConsumersList(subscribers); } // Clean up an disposed destinations to save space. for (Destination destination : disposed) { destinations.remove(destination.getName()); } abortAllQualifiedSlowConsumers(); }