Package org.apache.storm.utils
Class Time
- java.lang.Object
-
- org.apache.storm.utils.Time
-
public class Time extends Object
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
Nested Classes Modifier and Type Class Description static class
Time.SimulatedTime
-
Constructor Summary
Constructors Constructor Description Time()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
advanceTime(long ms)
static void
advanceTimeNanos(long nanos)
static void
advanceTimeSecs(long secs)
static long
currentTimeMillis()
static int
currentTimeSecs()
static long
deltaMs(long timeInMilliseconds)
static int
deltaSecs(int timeInSeconds)
static boolean
isSimulating()
static boolean
isThreadWaiting(Thread t)
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)
-
-
-
Method Detail
-
isSimulating
public static boolean isSimulating()
-
sleepUntil
public static void sleepUntil(long targetTimeMs) throws InterruptedException
- Throws:
InterruptedException
-
sleepUntilNanos
public static void sleepUntilNanos(long targetTimeNanos) throws InterruptedException
- Throws:
InterruptedException
-
sleep
public static void sleep(long ms) throws InterruptedException
- Throws:
InterruptedException
-
parkNanos
public static void parkNanos(long nanos) throws InterruptedException
- Throws:
InterruptedException
-
sleepSecs
public static void sleepSecs(long secs) throws InterruptedException
- 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
public static boolean isThreadWaiting(Thread t)
-
-