java.lang.Object
org.apache.sling.distribution.journal.impl.subscriber.SubscriberReady
All Implemented Interfaces:
Closeable, AutoCloseable, IdleCheck

public class SubscriberReady extends Object implements IdleCheck
A DistributionSubscriber is considered ready when one of the conditions is met:
  • is idle (no further message received) for more than the idleMillis at least once
  • is busy processing the same package for more than MAX_RETRIES times. (blocked queue assumed)
  • received message created time is less than 120 seconds
  • DEFAULT_FORCE_IDLE_MILLIS time has passed
After becoming ready once, the check stays ready.
  • Field Details

    • ACCEPTABLE_AGE_DIFF_MS

      public static final long ACCEPTABLE_AGE_DIFF_MS
    • MAX_RETRIES

      public static final int MAX_RETRIES
      See Also:
  • Constructor Details

    • SubscriberReady

      public SubscriberReady(String subAgentName, long idleMillis, long forceIdleMillies, AtomicBoolean readyHolder, Supplier<Long> timeProvider)
  • Method Details

    • isReady

      public boolean isReady()
      Specified by:
      isReady in interface IdleCheck
    • busy

      public void busy(int retries, long messageCreateTime)
      Called when processing of a message starts
      Specified by:
      busy in interface IdleCheck
      Parameters:
      retries - the number of retries to process the message
      messageCreateTime -
    • idle

      public void idle()
      Called when processing of a message has finished
      Specified by:
      idle in interface IdleCheck
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable