protected void basicCancel() { basicCancel(false); }
protected void basicCancel() { basicCancel(false); }
@Override public void handleCancel(String consumerTag) throws IOException { if (logger.isWarnEnabled()) { logger.warn("Cancel received for " + consumerTag + " (" + this.queue + "); " + BlockingQueueConsumer.this); } BlockingQueueConsumer.this.consumers.remove(this.queue); if (!BlockingQueueConsumer.this.consumers.isEmpty()) { basicCancel(false); } else { BlockingQueueConsumer.this.cancelled.set(true); } }
private void considerStoppingAConsumer(BlockingQueueConsumer consumer) { synchronized (this.consumersMonitor) { if (this.consumers != null && this.consumers.size() > this.concurrentConsumers) { long now = System.currentTimeMillis(); if (this.lastConsumerStopped + this.stopConsumerMinInterval < now) { consumer.basicCancel(true); this.consumers.remove(consumer); if (logger.isDebugEnabled()) { logger.debug("Idle consumer terminating: " + consumer); } this.lastConsumerStopped = now; } } } }
@Override public void handleCancel(String consumerTag) throws IOException { if (logger.isWarnEnabled()) { logger.warn("Cancel received for " + consumerTag + " (" + this.queue + "); " + BlockingQueueConsumer.this); } BlockingQueueConsumer.this.consumers.remove(this.queue); if (!BlockingQueueConsumer.this.consumers.isEmpty()) { basicCancel(false); } else { BlockingQueueConsumer.this.cancelled.set(true); } }
private void considerStoppingAConsumer(BlockingQueueConsumer consumer) { synchronized (this.consumersMonitor) { if (this.consumers != null && this.consumers.size() > this.concurrentConsumers) { long now = System.currentTimeMillis(); if (this.lastConsumerStopped + this.stopConsumerMinInterval < now) { consumer.basicCancel(true); this.consumers.remove(consumer); if (logger.isDebugEnabled()) { logger.debug("Idle consumer terminating: " + consumer); } this.lastConsumerStopped = now; } } } }
private void queuesChanged() { synchronized (this.consumersMonitor) { if (this.consumers != null) { int count = 0; Iterator<BlockingQueueConsumer> consumerIterator = this.consumers.iterator(); while (consumerIterator.hasNext()) { BlockingQueueConsumer consumer = consumerIterator.next(); if (logger.isDebugEnabled()) { logger.debug("Queues changed; stopping consumer: " + consumer); } consumer.basicCancel(true); consumerIterator.remove(); count++; } this.addAndStartConsumers(count); } } }
private void queuesChanged() { synchronized (this.consumersMonitor) { if (this.consumers != null) { int count = 0; Iterator<BlockingQueueConsumer> consumerIterator = this.consumers.iterator(); while (consumerIterator.hasNext()) { BlockingQueueConsumer consumer = consumerIterator.next(); if (logger.isDebugEnabled()) { logger.debug("Queues changed; stopping consumer: " + consumer); } consumer.basicCancel(true); consumerIterator.remove(); count++; } this.addAndStartConsumers(count); } } }
/** * Adjust consumers depending on delta. * @param deltaArg a negative value increases, positive decreases. * @since 1.7.8 */ protected void adjustConsumers(int deltaArg) { int delta = deltaArg; synchronized (this.consumersMonitor) { if (isActive() && this.consumers != null) { if (delta > 0) { Iterator<BlockingQueueConsumer> consumerIterator = this.consumers.iterator(); while (consumerIterator.hasNext() && delta > 0 && (this.maxConcurrentConsumers == null || this.consumers.size() > this.maxConcurrentConsumers)) { BlockingQueueConsumer consumer = consumerIterator.next(); consumer.basicCancel(true); consumerIterator.remove(); delta--; } } else { addAndStartConsumers(-delta); } } } }
/** * Adjust consumers depending on delta. * @param deltaArg a negative value increases, positive decreases. * @since 1.7.8 */ protected void adjustConsumers(int deltaArg) { int delta = deltaArg; synchronized (this.consumersMonitor) { if (isActive() && this.consumers != null) { if (delta > 0) { Iterator<BlockingQueueConsumer> consumerIterator = this.consumers.iterator(); while (consumerIterator.hasNext() && delta > 0 && (this.maxConcurrentConsumers == null || this.consumers.size() > this.maxConcurrentConsumers)) { BlockingQueueConsumer consumer = consumerIterator.next(); consumer.basicCancel(true); consumerIterator.remove(); delta--; } } else { addAndStartConsumers(-delta); } } } }
while (consumerIterator.hasNext()) { BlockingQueueConsumer consumer = consumerIterator.next(); consumer.basicCancel(true); canceledConsumers.add(consumer); consumerIterator.remove();
while (consumerIterator.hasNext()) { BlockingQueueConsumer consumer = consumerIterator.next(); consumer.basicCancel(true); canceledConsumers.add(consumer); consumerIterator.remove();