T - The type that will be returned from the get(java.lang.Object) and computeValue(java.lang.Object) methods.X - The type of argument that will be passed to the get(java.lang.Object) and computeValue(java.lang.Object) methods in order to initialize the ThreadSafeAccessor value.@ConsumerType public abstract class ThreadSafeAccessor<T,X> extends Object
computeValue(java.lang.Object) is only called once by a single thread.| Constructor and Description |
|---|
ThreadSafeAccessor() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
computeValue(X args)
Returns the initial value of the
ThreadSafeAccessor. |
T |
get(X arg)
Returns the
ThreadSafeAccessor value. |
public final T get(X arg)
ThreadSafeAccessor value. The value is lazily initialized by the first thread that attempts
to access it.arg - The argument needed to initialize the ThreadSafeAccessor value.protected abstract T computeValue(X args)
ThreadSafeAccessor. This method will only be called once by a single
thread to obtain the initial value. Subclasses must override this method to provide the process necessary to
compute the initial value of the ThreadSafeAccessor.args - The argument needed to initialize the ThreadSafeAccessor value.Copyright © 2020 Liferay, Inc.. All rights reserved.