T - type of the contained state objects.public class StateObjectCollection<T extends StateObject> extends Object implements Collection<T>, StateObject
StateObjects. Being a state object itself,
it delegates discardState() to all contained state objects and computes getStateSize() as sum of the state sizes of all contained objects.StateObject.StateObjectLocation, StateObject.StateObjectSizeStatsCollector| Constructor and Description |
|---|
StateObjectCollection()
Creates a new StateObjectCollection that is backed by an
ArrayList. |
StateObjectCollection(Collection<T> stateObjects)
Creates a new StateObjectCollection wraps the given collection and delegates to it.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T t) |
boolean |
addAll(Collection<? extends T> c) |
List<T> |
asList() |
void |
clear() |
void |
collectSizeStats(StateObject.StateObjectSizeStatsCollector collector)
Collects statistics about state size and location from the state object.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
void |
discardState()
Discards the state referred to and solemnly owned by this handle, to free up resources in the
persistent storage.
|
static <T extends StateObject> |
empty() |
static <T extends StateObject> |
emptyIfNull(StateObjectCollection<T> collection) |
boolean |
equals(Object o) |
long |
getCheckpointedSize() |
long |
getStateSize()
Returns the size of the state in bytes.
|
int |
hashCode() |
boolean |
hasState()
Returns true if this contains at least one
StateObject. |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
removeIf(java.util.function.Predicate<? super T> filter) |
boolean |
retainAll(Collection<?> c) |
static <T extends StateObject> |
singleton(T stateObject) |
static <T extends StateObject> |
singletonOrEmpty(T stateObject) |
int |
size() |
Object[] |
toArray() |
<T1> T1[] |
toArray(T1[] a) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitparallelStream, spliterator, streampublic StateObjectCollection()
ArrayList.public StateObjectCollection(Collection<T> stateObjects)
stateObjects - collection of state objects to wrap.public int size()
size in interface Collection<T extends StateObject>public boolean isEmpty()
isEmpty in interface Collection<T extends StateObject>public boolean contains(Object o)
contains in interface Collection<T extends StateObject>public Iterator<T> iterator()
iterator in interface Iterable<T extends StateObject>iterator in interface Collection<T extends StateObject>public Object[] toArray()
toArray in interface Collection<T extends StateObject>public <T1> T1[] toArray(T1[] a)
toArray in interface Collection<T extends StateObject>public boolean add(T t)
add in interface Collection<T extends StateObject>public boolean remove(Object o)
remove in interface Collection<T extends StateObject>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<T extends StateObject>public boolean addAll(Collection<? extends T> c)
addAll in interface Collection<T extends StateObject>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<T extends StateObject>public boolean removeIf(java.util.function.Predicate<? super T> filter)
removeIf in interface Collection<T extends StateObject>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<T extends StateObject>public void clear()
clear in interface Collection<T extends StateObject>public void discardState()
throws Exception
StateObjectdiscardState in interface StateObjectExceptionpublic long getStateSize()
StateObject0.
The values produced by this method are only used for informational purposes and for metrics/monitoring. If this method returns wrong values, the checkpoints and recovery will still behave correctly. However, efficiency may be impacted (wrong space pre-allocation) and functionality that depends on metrics (like monitoring) will be impacted.
Note for implementors: This method should not perform any I/O operations while obtaining
the state size (hence it does not declare throwing an IOException). Instead, the
state size should be stored in the state object, or should be computable from the state
stored in this object. The reason is that this method is called frequently by several parts
of the checkpointing and issuing I/O requests from this method accumulates a heavy I/O load
on the storage system at higher scale.
getStateSize in interface StateObjectpublic void collectSizeStats(StateObject.StateObjectSizeStatsCollector collector)
StateObjectcollectSizeStats in interface StateObjectcollector - the statistics collector.public long getCheckpointedSize()
public boolean hasState()
StateObject.public boolean equals(Object o)
equals in interface Collection<T extends StateObject>equals in class Objectpublic int hashCode()
hashCode in interface Collection<T extends StateObject>hashCode in class Objectpublic static <T extends StateObject> StateObjectCollection<T> empty()
public static <T extends StateObject> StateObjectCollection<T> emptyIfNull(@Nullable StateObjectCollection<T> collection)
public static <T extends StateObject> StateObjectCollection<T> singleton(T stateObject)
public static <T extends StateObject> StateObjectCollection<T> singletonOrEmpty(@Nullable T stateObject)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.