public class PropUtil extends Object
| Constructor and Description |
|---|
PropUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
durationToMillis(long val,
TimeUnit unit)
Converts the given duration (interval value plus unit) to milliseconds,
ensuring that any given value greater than zero converts to at least one
millisecond to avoid a zero millisecond result, since Object.wait(0)
waits forever.
|
static String |
formatDuration(long time,
TimeUnit unit)
Formats a String duration property (time + optional unit).
|
static long |
millisToDuration(int val,
TimeUnit unit)
Converts the given duration value in milliseconds to the given unit.
|
static int |
parseDuration(String property)
Parses a String duration property (time + optional unit) and returns the
value in millis.
|
static long |
parseDurationNS(String property)
Parses a String duration property (time + optional unit) and returns the
value in nanos.
|
public static int durationToMillis(long val,
TimeUnit unit)
IllegalArgumentException - if the duration argument is illegal.
Thrown via API setter methods such as Transaction.setLockTimeout.public static long millisToDuration(int val,
TimeUnit unit)
IllegalArgumentException - if the unit is null. Thrown via API
getter methods such as Transaction.getLockTimeout.public static int parseDuration(String property)
IllegalArgumentException - if the duration string is illegal.
Thrown via the Environment ctor and setMutableConfig, and likewise for a
ReplicatedEnvironment.public static long parseDurationNS(String property)
IllegalArgumentException - if the duration string is illegal.
Thrown via the Environment ctor and setMutableConfig, and likewise for a
ReplicatedEnvironment.Copyright © 2024. All rights reserved.