public final class TimeGuard extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
TimeGuard.TimeAlertListener
Interface for any object to be informed about time alerts.
|
static class |
TimeGuard.TimeData
Data container for time watching action.
|
| Modifier and Type | Field and Description |
|---|---|
static TimeGuard.TimeAlertListener |
NULL_TIME_ALERT_LISTENER
Some variant of "null-device" for time alerts, it does absolutely nothing.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addGuard(String alertMessage,
long maxAllowedDelayInMilliseconds)
Add a time watcher.
|
static void |
addGuard(String alertMessage,
long maxAllowedDelayInMilliseconds,
TimeGuard.TimeAlertListener timeAlertListener)
Add a time watcher and provide processor of time violation.
|
static void |
addPoint(String timePointName,
TimeGuard.TimeAlertListener listener)
Add a named time point.
|
static void |
cancel()
Cancel all time watchers and time points for the current stack level.
|
static void |
cancelAll()
Cancel all time watchers and time points globally for the current thread.
|
static void |
check()
Check all registered time watchers for time bound violations.
|
static void |
checkPoint(String timePointName)
Check named time point(s).
|
static void |
checkPoints()
Process all time points for the current stack level.
|
static boolean |
isEmpty()
Check that the thread local for the current thread contains time points or watchers.
|
public static final TimeGuard.TimeAlertListener NULL_TIME_ALERT_LISTENER
@Weight(value=VARIABLE, comment="Depends on the current call stack depth") public static void addGuard(String alertMessage, @Constraint(value="X>0") long maxAllowedDelayInMilliseconds)
alertMessage - message for time violationmaxAllowedDelayInMilliseconds - max allowed delay in milliseconds for executing blockcheck(),
cancelAll(),
MetaErrorListeners@Weight(value=VARIABLE, comment="Depends on the current call stack depth") public static void addPoint(String timePointName, TimeGuard.TimeAlertListener listener)
timePointName - name for the time pointlistener - listener to be notifiedcheckPoint(java.lang.String)@Weight(value=VARIABLE, comment="Depends on the current call stack depth") public static void checkPoint(String timePointName)
timePointName - the name of time point@Weight(value=VARIABLE, comment="Depends on the current call stack depth") public static void checkPoints()
@Weight(value=VARIABLE, comment="Depends on the current call stack depth") public static void addGuard(String alertMessage, @Constraint(value="X>0") long maxAllowedDelayInMilliseconds, TimeGuard.TimeAlertListener timeAlertListener)
alertMessage - message for time violationmaxAllowedDelayInMilliseconds - max allowed delay in milliseconds for executing blocktimeAlertListener - alert listener to be notified, if it is null then the global one will get notificationcheck(),
cancelAll()@Weight(value=NORMAL) public static void cancelAll()
cancel()@Weight(value=VARIABLE, comment="Depends on the current call stack depth") public static void cancel()
cancelAll()@Weight(value=VARIABLE, comment="Depends on the current call stack depth") public static void check()
Copyright © 2011–2022 Igor Maznitsa. All rights reserved.