Java Code Examples for org.apache.activemq.artemis.core.settings.impl.AddressSettings#getSlowConsumerThreshold()

The following examples show how to use org.apache.activemq.artemis.core.settings.impl.AddressSettings#getSlowConsumerThreshold() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueueImpl.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
private void configureSlowConsumerReaper(final AddressSettings settings) {
   if (settings == null || settings.getSlowConsumerThreshold() == AddressSettings.DEFAULT_SLOW_CONSUMER_THRESHOLD) {
      if (slowConsumerReaperFuture != null) {
         slowConsumerReaperFuture.cancel(false);
         slowConsumerReaperFuture = null;
         slowConsumerReaperRunnable = null;
         if (logger.isDebugEnabled()) {
            logger.debug("Cancelled slow-consumer-reaper thread for queue \"" + getName() + "\"");
         }
      }
   } else {
      if (slowConsumerReaperRunnable == null) {
         scheduleSlowConsumerReaper(settings);
      } else if (slowConsumerReaperRunnable.checkPeriod != settings.getSlowConsumerCheckPeriod() || slowConsumerReaperRunnable.threshold != settings.getSlowConsumerThreshold() || !slowConsumerReaperRunnable.policy.equals(settings.getSlowConsumerPolicy())) {
         if (slowConsumerReaperFuture != null) {
            slowConsumerReaperFuture.cancel(false);
            slowConsumerReaperFuture = null;
         }
         scheduleSlowConsumerReaper(settings);
      }
   }
}
 
Example 2
Source File: QueueImpl.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
void scheduleSlowConsumerReaper(AddressSettings settings) {
   slowConsumerReaperRunnable = new SlowConsumerReaperRunnable(settings.getSlowConsumerCheckPeriod(), settings.getSlowConsumerThreshold(), settings.getSlowConsumerPolicy());

   slowConsumerReaperFuture = scheduledExecutor.scheduleWithFixedDelay(slowConsumerReaperRunnable, settings.getSlowConsumerCheckPeriod(), settings.getSlowConsumerCheckPeriod(), TimeUnit.SECONDS);

   if (logger.isDebugEnabled()) {
      logger.debug("Scheduled slow-consumer-reaper thread for queue \"" + getName() + "\"; slow-consumer-check-period=" + settings.getSlowConsumerCheckPeriod() + ", slow-consumer-threshold=" + settings.getSlowConsumerThreshold() + ", slow-consumer-policy=" + settings.getSlowConsumerPolicy());
   }
}