Class ClockFactory
- java.lang.Object
-
- org.apache.logging.log4j.core.util.ClockFactory
-
public final class ClockFactory extends java.lang.Object
Factory forClock
objects.
-
-
Field Summary
Fields Modifier and Type Field Description private static StatusLogger
LOGGER
static java.lang.String
PROPERTY_NAME
Name of the system property that can be used to specify aClock
implementation class.
-
Constructor Summary
Constructors Modifier Constructor Description private
ClockFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.util.Map<java.lang.String,Supplier<Clock>>
aliases()
private static Clock
createClock()
static Clock
getClock()
Returns aClock
instance depending on the value of system propertyPROPERTY_NAME
.private static Clock
logSupportedPrecision(Clock clock)
-
-
-
Field Detail
-
PROPERTY_NAME
public static final java.lang.String PROPERTY_NAME
Name of the system property that can be used to specify aClock
implementation class. The value of this property is "log4j.Clock".- See Also:
- Constant Field Values
-
LOGGER
private static final StatusLogger LOGGER
-
-
Method Detail
-
getClock
public static Clock getClock()
Returns aClock
instance depending on the value of system propertyPROPERTY_NAME
.If system property
log4j.Clock=CachedClock
is specified, this method returns an instance ofCachedClock
. If system propertylog4j.Clock=CoarseCachedClock
is specified, this method returns an instance ofCoarseCachedClock
.If another value is specified, this value is taken as the fully qualified class name of a class that implements the
Clock
interface. An object of this class is instantiated and returned.If no value is specified, or if the specified value could not correctly be instantiated or did not implement the
Clock
interface, then an instance ofSystemClock
is returned.- Returns:
- a
Clock
instance
-
createClock
private static Clock createClock()
-
-