Class ClockTooManyBackwardsException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
me.ahoo.cosid.CosIdException
me.ahoo.cosid.snowflake.exception.ClockTooManyBackwardsException
- All Implemented Interfaces:
Serializable
Exception thrown when clock backwards exceeds threshold.
Indicates that the system clock has moved backwards by more than the configured broken threshold, and the generator cannot recover.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionClockTooManyBackwardsException(long lastTimestamp, long currentTimestamp, long brokenThreshold) Creates a new exception. -
Method Summary
Modifier and TypeMethodDescriptionlongGets the broken threshold.longGets the current timestamp.longGets the last timestamp.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ClockTooManyBackwardsException
public ClockTooManyBackwardsException(long lastTimestamp, long currentTimestamp, long brokenThreshold) Creates a new exception.- Parameters:
lastTimestamp- the last generated timestampcurrentTimestamp- the current system timestampbrokenThreshold- the configured broken threshold
-
-
Method Details
-
getLastTimestamp
public long getLastTimestamp()Gets the last timestamp.- Returns:
- the last timestamp
-
getCurrentTimestamp
public long getCurrentTimestamp()Gets the current timestamp.- Returns:
- the current timestamp
-
getBrokenThreshold
public long getBrokenThreshold()Gets the broken threshold.- Returns:
- the broken threshold
-