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.| 构造器和说明 |
|---|
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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(T t) |
boolean |
addAll(Collection<? extends T> c) |
List<T> |
asList() |
void |
clear() |
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() |
parallelStream, spliterator, streampublic StateObjectCollection()
ArrayList.public StateObjectCollection(Collection<T> stateObjects)
stateObjects - collection of state objects to wrap.public int size()
size 在接口中 Collection<T extends StateObject>public boolean isEmpty()
isEmpty 在接口中 Collection<T extends StateObject>public boolean contains(Object o)
contains 在接口中 Collection<T extends StateObject>public Iterator<T> iterator()
iterator 在接口中 Iterable<T extends StateObject>iterator 在接口中 Collection<T extends StateObject>public Object[] toArray()
toArray 在接口中 Collection<T extends StateObject>public <T1> T1[] toArray(T1[] a)
toArray 在接口中 Collection<T extends StateObject>public boolean add(T t)
add 在接口中 Collection<T extends StateObject>public boolean remove(Object o)
remove 在接口中 Collection<T extends StateObject>public boolean containsAll(Collection<?> c)
containsAll 在接口中 Collection<T extends StateObject>public boolean addAll(Collection<? extends T> c)
addAll 在接口中 Collection<T extends StateObject>public boolean removeAll(Collection<?> c)
removeAll 在接口中 Collection<T extends StateObject>public boolean removeIf(java.util.function.Predicate<? super T> filter)
removeIf 在接口中 Collection<T extends StateObject>public boolean retainAll(Collection<?> c)
retainAll 在接口中 Collection<T extends StateObject>public void clear()
clear 在接口中 Collection<T extends StateObject>public void discardState()
throws Exception
StateObjectdiscardState 在接口中 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 在接口中 StateObjectpublic long getCheckpointedSize()
public boolean hasState()
StateObject.public boolean equals(Object o)
equals 在接口中 Collection<T extends StateObject>equals 在类中 Objectpublic int hashCode()
hashCode 在接口中 Collection<T extends StateObject>hashCode 在类中 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–2023 The Apache Software Foundation. All rights reserved.