Class LoggingMonotonicTimestampGenerator

    • Constructor Detail

      • LoggingMonotonicTimestampGenerator

        protected LoggingMonotonicTimestampGenerator​(long warningThreshold,
                                                     TimeUnit warningThresholdUnit,
                                                     long warningInterval,
                                                     TimeUnit warningIntervalUnit)
        Creates a new instance.
        Parameters:
        warningThreshold - how far in the future timestamps are allowed to drift before a warning is logged.
        warningThresholdUnit - the unit for warningThreshold.
        warningInterval - how often the warning will be logged if timestamps keep drifting above the threshold.
        warningIntervalUnit - the unit for warningIntervalUnit.
    • Method Detail

      • onDrift

        protected void onDrift​(long currentTick,
                               long lastTimestamp)
        Called when generated timestamps drift into the future compared to the underlying clock (in other words, if lastTimestamp >= currentTick).

        This could happen if timestamps are requested faster than the clock granularity, or on a clock skew (for example because of a leap second).

        This implementation logs a warning at regular intervals when timestamps drift more than a specified threshold in the future. These messages are emitted at WARN level in the category com.datastax.driver.core.TimestampGenerator.

        Specified by:
        onDrift in class AbstractMonotonicTimestampGenerator
        Parameters:
        currentTick - the current clock tick.
        lastTimestamp - the last timestamp that was generated.