Implementation Note
This implementation can be used early in the boot sequence as it does not rely on reflection, MethodHandles, Streams etc.
| Modifier and Type | Field and Description |
|---|---|
| private volatile Object | |
| private T | |
| private static final long | |
| private static final Unsafe |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public T | get()
Implements java. Returns the initialized content of this constant, computing it if necessary. |
| private T | |
| private T | |
| public static String | |
| public static <T> LazyConstantImpl | |
| public T | |
| private void | |
| private void | |
| public String | toString()
Overrides java. Implements java. Returns a string suitable for debugging. |
| private String | |
| pack-priv static NoSuchElementException |
| computingFunctionOrExceptionType | back to summary |
|---|---|
| private volatile Object computingFunctionOrExceptionType | |
| constant | back to summary |
|---|---|
| private T constant
| |
| CONSTANT_OFFSET | back to summary |
|---|---|
| private static final long CONSTANT_OFFSET | |
| UNSAFE | back to summary |
|---|---|
| private static final Unsafe UNSAFE | |
| LazyConstantImpl | back to summary |
|---|---|
| private LazyConstantImpl(Supplier<? extends T> computingFunction) | |
| get | back to summary |
|---|---|
| public T get() Implements java. Doc from java. Returns the initialized content of this constant, computing it if necessary. If this constant is not initialized, first computes and initializes it using the computing function. After this method returns successfully, the constant is guaranteed to be initialized.
If an unchecked exception is thrown when evaluating the computing function or if
the computing function returns
| |
| getAcquire | back to summary |
|---|---|
private T getAcquire()
| |
| getSlowPath | back to summary |
|---|---|
private T getSlowPath()
| |
| isolateToString | back to summary |
|---|---|
| public static String isolateToString(Object input) | |
| ofLazy | back to summary |
|---|---|
| public static <T> LazyConstantImpl | |
| orElse | back to summary |
|---|---|
public T orElse(T other)
| |
| preventReentry | back to summary |
|---|---|
| private void preventReentry() | |
| setRelease | back to summary |
|---|---|
| private void setRelease(T newValue) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Implements java. Doc from java. Returns a string suitable for debugging. This method never triggers initialization of this lazy constant and will observe initialization by other threads atomically (i.e., it observes the content if and only if the initialization has already completed). If this lazy constant is initialized, an implementation-dependent string containing the Object#toString() of the content will be returned; otherwise, an implementation-dependent string is returned that indicates this lazy constant is not yet initialized.
| |
| toStringSuffix | back to summary |
|---|---|
| private String toStringSuffix() | |
| unableToAccessConstant | back to summary |
|---|---|
| pack-priv static NoSuchElementException unableToAccessConstant(String exceptionType, Throwable cause) | |