Package com.yahoo.concurrent
Enum SystemTimer
- java.lang.Object
-
- java.lang.Enum<SystemTimer>
-
- com.yahoo.concurrent.SystemTimer
-
- All Implemented Interfaces:
Timer
,Serializable
,Comparable<SystemTimer>
public enum SystemTimer extends Enum<SystemTimer> implements Timer
This is an implementation ofTimer
that is backed by an actual system timer.- Author:
- Simon Thoresen Hult
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Duration
adjustTimeoutByDetectedHz(Duration timeout)
static Duration
adjustTimeoutByDetectedHz(Duration timeout, long hz)
static long
detectHz()
long
milliTime()
Returns the current value of some arbitrary timer, in milliseconds.static SystemTimer
valueOf(String name)
Returns the enum constant of this type with the specified name.static SystemTimer[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final SystemTimer INSTANCE
-
-
Method Detail
-
values
public static SystemTimer[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SystemTimer c : SystemTimer.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SystemTimer valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
detectHz
public static long detectHz()
-
adjustTimeoutByDetectedHz
public static Duration adjustTimeoutByDetectedHz(Duration timeout, long hz)
-
milliTime
public long milliTime()
Description copied from interface:Timer
Returns the current value of some arbitrary timer, in milliseconds. This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.
-
-