Top Description Fields Constructors Methods
org.jooq.impl

pack-priv final Class Lazy<T>

extends Object
Class Inheritance
Imports
java.util.function.Supplier

A utility for lazy initialisation of constant values.

Eager static initialisation of constant values has produced numerous race conditions and deadlocks in the past in user code that initialised jOOQ classes in parallel. For example:

This generic Lazy utility should delay the initialisation of the constant in the absence of formal JDK support: https://openjdk.org/jeps/8209964

Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private final Supplier<? extends T>
private volatile T

Constructor Summary

AccessConstructor and Description
private
Lazy(Supplier<? extends T> supplier)

Method Summary

Modifier and TypeMethod and Description
pack-priv T
get()

pack-priv static <T> Lazy<T>
of(Supplier<? extends T> supplier)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

supplierback to summary
private final Supplier<? extends T> supplier
valueback to summary
private volatile T value

Constructor Detail

Lazyback to summary
private Lazy(Supplier<? extends T> supplier)

Method Detail

getback to summary
pack-priv T get()
ofback to summary
pack-priv static <T> Lazy<T> of(Supplier<? extends T> supplier)