Package org.summerboot.jexpress.nio
Class IdleEventMonitor
java.lang.Object
org.summerboot.jexpress.nio.IdleEventMonitor
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.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetName()longgetTTLMillis(long thresholdMillis) longgetTTLMillis(long threshold, TimeUnit timeUnit) booleanisTimeout(long thresholdMillis) booleanstatic voidstart(IdleEventMonitor idleEventMonitor, IdleEventMonitor.IdleEventListener idleEventListener, long threshold, TimeUnit timeUnit) static voidstop()static voidstop(IdleEventMonitor idleEventMonitor) voidvoid
-
Field Details
-
log
protected static final org.apache.logging.log4j.Logger log
-
-
Constructor Details
-
IdleEventMonitor
-
-
Method Details
-
getName
-
update
-
update
-
getLastTransactionId
-
getLastTimestamp
public long getLastTimestamp() -
getTTLMillis
-
getTTLMillis
public long getTTLMillis(long thresholdMillis) -
isTimeout
-
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
-
stop
public static void stop()
-