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
| Modifier and Type | Field and Description |
|---|---|
| private final Supplier | |
| private volatile T |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv T | |
| pack-priv static <T> Lazy |
| supplier | back to summary |
|---|---|
| private final Supplier<? extends T> supplier | |
| value | back to summary |
|---|---|
| private volatile T value | |
| Lazy | back to summary |
|---|---|
| private Lazy(Supplier<? extends T> supplier) | |
| get | back to summary |
|---|---|
| pack-priv T get() | |
| of | back to summary |
|---|---|
| pack-priv static <T> Lazy | |