SystemTimeSource (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.utils

## Class SystemTimeSource

- java.lang.Object
- - org.apache.cassandra.utils.SystemTimeSource

- All Implemented Interfaces:
    TimeSource

      public class SystemTimeSource
      extends java.lang.Object
      implements TimeSource

  Time source backed by JVM clock.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SystemTimeSource()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `currentTimeMillis()`
    `long` | `nanoTime()`
    `TimeSource` | `sleep(long sleepFor, java.util.concurrent.TimeUnit unit)` Sleep for the given amount of time.
    `TimeSource` | `sleepUninterruptibly(long sleepFor, java.util.concurrent.TimeUnit unit)` Sleep for the given amount of time uninterruptibly.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SystemTimeSource

          public SystemTimeSource()

  - ### Method Detail

    - #### currentTimeMillis

          public long currentTimeMillis()

      Specified by:
        `currentTimeMillis` in interface `TimeSource`
      Returns:
        the current time in milliseconds

    - #### nanoTime

          public long nanoTime()

      Specified by:
        `nanoTime` in interface `TimeSource`
      Returns:
        Returns the current time value in nanoseconds.

        This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.

    - #### sleepUninterruptibly

          public TimeSource sleepUninterruptibly(long sleepFor,
                                                 java.util.concurrent.TimeUnit unit)

      Description copied from interface: `TimeSource`
      Sleep for the given amount of time uninterruptibly.
      Specified by:
        `sleepUninterruptibly` in interface `TimeSource`
      Parameters:
        `sleepFor` - given amout.
        `unit` - time unit
      Returns:
        The time source itself after the given sleep period.

    - #### sleep

          public TimeSource sleep(long sleepFor,
                                  java.util.concurrent.TimeUnit unit)
                           throws java.lang.InterruptedException

      Description copied from interface: `TimeSource`
      Sleep for the given amount of time. This operation could interrupted. Hence after returning from this method, it is not guaranteed that the request amount of time has passed.
      Specified by:
        `sleep` in interface `TimeSource`
      Parameters:
        `sleepFor` - given amout.
        `unit` - time unit
      Returns:
        The time source itself after the given sleep period.
      Throws:
        `java.lang.InterruptedException`

Copyright © 2018 The Apache Software Foundation