public final class ClockFactory
extends java.lang.Object
Clock
objects.Modifier and Type | Field and Description |
---|---|
private static StatusLogger |
LOGGER |
static java.lang.String |
PROPERTY_NAME
Name of the system property that can be used to specify a
Clock
implementation class. |
Modifier | Constructor and Description |
---|---|
private |
ClockFactory() |
Modifier and Type | Method and Description |
---|---|
private static java.util.Map<java.lang.String,Supplier<Clock>> |
aliases() |
private static Clock |
createClock() |
static Clock |
getClock()
Returns a
Clock instance depending on the value of system
property PROPERTY_NAME . |
private static Clock |
logSupportedPrecision(Clock clock) |
public static final java.lang.String PROPERTY_NAME
Clock
implementation class. The value of this property is "log4j.Clock".private static final StatusLogger LOGGER
public static Clock getClock()
Clock
instance depending on the value of system
property PROPERTY_NAME
.
If system property log4j.Clock=CachedClock
is specified,
this method returns an instance of CachedClock
. If system
property log4j.Clock=CoarseCachedClock
is specified, this
method returns an instance of CoarseCachedClock
.
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 of SystemClock
is returned.
Clock
instanceprivate static Clock createClock()