T
- The type of value returned by read()
.@Experimental(value=STATE) public interface ReadableState<T>
State
that can be read via read()
.
Use readLater()
for marking several states for prefetching. Runners can potentially
batch these into one read.
Modifier and Type | Method and Description |
---|---|
T |
read()
Read the current value, blocking until it is available.
|
ReadableState<T> |
readLater()
Indicate that the value will be read later.
|
T read()
If there will be many calls to read()
for different state in short succession, you
should first call readLater()
for all of them so the reads can potentially be batched
(depending on the underlying implementation}.
The returned object should be independent of the underlying state. Any direct modification of the returned object should not modify state without going through the appropriate state interface, and modification to the state should not be mirrored in the returned object.
ReadableState<T> readLater()
This allows an implementation to start an asynchronous prefetch or to include this state in the next batch of reads.