public final class TimeUtil extends Object implements Runnable
Provides millisecond-level time of OS.
Here we should see that not all the time TimeUtil should keep looping 1_000 times every second (Actually about 800/s due to some losses).
* In idle conditions it just acts as System.currentTimeMillis(); * In busy conditions (significantly more than 1_000/s) it keeps loop to reduce costs.For detail design and proposals please goto https://github.com/alibaba/Sentinel/issues/1702
| Modifier and Type | Class and Description |
|---|---|
static class |
TimeUtil.STATE |
| Constructor and Description |
|---|
TimeUtil() |
| Modifier and Type | Method and Description |
|---|---|
Tuple2<Long,Long> |
currentQps(long now)
Current qps statistics (including reads and writes request)
excluding current working time window for accurate result.
|
static long |
currentTimeMillis() |
TimeUtil.STATE |
getState()
Current running state
|
long |
getTime()
Current timestamp in milliseconds.
|
static TimeUtil |
instance() |
void |
run() |
public TimeUtil.STATE getState()
public Tuple2<Long,Long> currentQps(long now)
now - public long getTime()
public static TimeUtil instance()
public static long currentTimeMillis()
Copyright © 2021 Alibaba Group. All rights reserved.