Class IdleEventMonitor

java.lang.Object
org.summerboot.jexpress.nio.IdleEventMonitor

public class IdleEventMonitor extends Object
IdleEventMonitor is a utility class to track the last request timestamp and loose transaction ID. It can be used to monitor idle states and trigger events when a request has not been received within a specified threshold. This class is thread-safe and can be used in a multi-threaded environment.
  • Field Details

    • log

      protected static final org.apache.logging.log4j.Logger log
  • Constructor Details

    • IdleEventMonitor

      public IdleEventMonitor(String name)
  • Method Details

    • getName

      public String getName()
    • update

      public void update(String transactionId)
    • update

      public void update(long timestamp, String transactionId)
    • getLastTransactionId

      public String getLastTransactionId()
    • getLastTimestamp

      public long getLastTimestamp()
    • getTTLMillis

      public long getTTLMillis(long threshold, TimeUnit timeUnit)
    • getTTLMillis

      public long getTTLMillis(long thresholdMillis)
    • isTimeout

      public boolean isTimeout(long threshold, TimeUnit timeUnit)
    • isTimeout

      public boolean isTimeout(long thresholdMillis)
    • start

      public static void start(IdleEventMonitor idleEventMonitor, IdleEventMonitor.IdleEventListener idleEventListener, long threshold, TimeUnit timeUnit) throws Exception
      Throws:
      Exception
    • stop

      public static void stop(IdleEventMonitor idleEventMonitor)
    • stop

      public static void stop()