public class SystemTimeSource extends java.lang.Object implements TimeSource
Constructor and Description |
---|
SystemTimeSource() |
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.
|
public long currentTimeMillis()
currentTimeMillis
in interface TimeSource
public long nanoTime()
nanoTime
in interface TimeSource
This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.
public TimeSource sleepUninterruptibly(long sleepFor, java.util.concurrent.TimeUnit unit)
TimeSource
sleepUninterruptibly
in interface TimeSource
sleepFor
- given amout.unit
- time unitpublic TimeSource sleep(long sleepFor, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
TimeSource
sleep
in interface TimeSource
sleepFor
- given amout.unit
- time unitjava.lang.InterruptedException
Copyright © 2009-2021 The Apache Software Foundation