Interface InternalKvState.StateIncrementalVisitor<K,N,V>
-
- Enclosing interface:
- InternalKvState<K,N,V>
public static interface InternalKvState.StateIncrementalVisitor<K,N,V>
The state entry visitor which supports remove and update of the last returned entries.The visitor should tolerate concurrent modifications. It might trade this tolerance for consistency and return duplicates or not all values (created while visiting) but always state values which exist and up-to-date at the moment of calling
nextEntries()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
hasNext()
Whether the visitor potentially has some next entries to return fromnextEntries()
.Collection<StateEntry<K,N,V>>
nextEntries()
Return some next entries which are available at the moment.void
remove(StateEntry<K,N,V> stateEntry)
void
update(StateEntry<K,N,V> stateEntry, V newValue)
Update the value of the last returned entry from thenext()
method.
-
-
-
Method Detail
-
hasNext
boolean hasNext()
Whether the visitor potentially has some next entries to return fromnextEntries()
.
-
nextEntries
Collection<StateEntry<K,N,V>> nextEntries()
Return some next entries which are available at the moment.If empty collection is returned, it does not mean that the visitor is exhausted but it means that the visitor has done some incremental work advancing and checking internal data structures. The finished state of the visitor has to be checked by
hasNext()
method.The returned collection and state values must not be changed internally (there might be no defensive copies in
nextEntries()
for performance). It has to be deeply copied if it is to modify, e.g. with theupdate()
method.
-
remove
void remove(StateEntry<K,N,V> stateEntry)
-
update
void update(StateEntry<K,N,V> stateEntry, V newValue)
Update the value of the last returned entry from thenext()
method.- Throws:
IllegalStateException
- if next() has never been called yet or iteration is over.
-
-