Package org.apache.storm.utils
Class Time
java.lang.Object
org.apache.storm.utils.Time
This class implements time simulation support. When time simulation is enabled, methods on this class will use fixed time. When time
simulation is disabled, methods will pass through to relevant java.lang.System/java.lang.Thread calls. Methods using units higher than
nanoseconds will pass through to System.currentTimeMillis(). Methods supporting nanoseconds will pass through to System.nanoTime().
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
advanceTime
(long ms) static void
advanceTimeNanos
(long nanos) static void
advanceTimeSecs
(long secs) static long
static int
static long
deltaMs
(long timeInMilliseconds) static int
deltaSecs
(int timeInSeconds) static boolean
static boolean
static long
millisToNanos
(long millis) static long
nanosToMillis
(long nanos) static long
nanoTime()
static void
parkNanos
(long nanos) static long
secsToMillis
(int secs) static long
secsToMillisLong
(double secs) static void
sleep
(long ms) static void
sleepSecs
(long secs) static void
sleepUntil
(long targetTimeMs) static void
sleepUntilNanos
(long targetTimeNanos)
-
Constructor Details
-
Time
public Time()
-
-
Method Details
-
isSimulating
public static boolean isSimulating() -
sleepUntil
- Throws:
InterruptedException
-
sleepUntilNanos
- Throws:
InterruptedException
-
sleep
- Throws:
InterruptedException
-
parkNanos
- Throws:
InterruptedException
-
sleepSecs
- Throws:
InterruptedException
-
nanoTime
public static long nanoTime() -
currentTimeMillis
public static long currentTimeMillis() -
nanosToMillis
public static long nanosToMillis(long nanos) -
millisToNanos
public static long millisToNanos(long millis) -
secsToMillis
public static long secsToMillis(int secs) -
secsToMillisLong
public static long secsToMillisLong(double secs) -
currentTimeSecs
public static int currentTimeSecs() -
deltaSecs
public static int deltaSecs(int timeInSeconds) -
deltaMs
public static long deltaMs(long timeInMilliseconds) -
advanceTime
public static void advanceTime(long ms) -
advanceTimeNanos
public static void advanceTimeNanos(long nanos) -
advanceTimeSecs
public static void advanceTimeSecs(long secs) -
isThreadWaiting
-