Skip to content

Commit 8bea28f

Browse files
Clarify live-view snapshot guarantees and format changes
Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
1 parent 65694dd commit 8bea28f

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎spring/src/main/java/io/kubernetes/client/spring/extended/manifests/KubernetesFromConfigMapProcessor.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public boolean containsKey(Object key) {
126126

127127
@Override
128128
public Set<Entry<String, String>> entrySet() {
129-
// The unmodifiable wrapper caches views; keep them live but pin each iterator to one snapshot.
129+
// Keep the unmodifiable wrapper's cached views live; each iterator captures a snapshot.
130130
return new AbstractSet<>() {
131131
@Override
132132
public Iterator<Entry<String, String>> iterator() {

‎spring/src/main/java/io/kubernetes/client/spring/extended/manifests/annotation/FromConfigMap.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
* complete, immutable copy of the ConfigMap data. Iteration (including {@code forEach}) and copies
3232
* such as {@code new HashMap<>(map)} observe one complete version. Views returned by {@code
3333
* entrySet()}, {@code keySet()}, and {@code values()} remain live, but each iterator retains the
34-
* version captured when it was created. Separate calls to {@code get} may observe different versions
35-
* if a refresh occurs between them; they are not a transaction.
34+
* version captured when it was created. Separate operations on the map or its views (for example,
35+
* two {@code get} calls, or {@code size()} followed by iteration) may observe different versions if
36+
* a refresh occurs between them; they are not a transaction.
3637
*
3738
* <p>Unlike the previously injected mutable cache map, the map and its views are now read-only.
3839
* Mutating operations throw {@link UnsupportedOperationException}. Copy the map into an

‎spring/src/test/java/io/kubernetes/client/spring/extended/manifests/KubernetesFromConfigMapTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
*/
1313
package io.kubernetes.client.spring.extended.manifests;
1414

15-
import static org.awaitility.Awaitility.await;
1615
import static org.assertj.core.api.Assertions.assertThat;
1716
import static org.assertj.core.api.Assertions.assertThatThrownBy;
17+
import static org.awaitility.Awaitility.await;
1818

1919
import io.kubernetes.client.openapi.models.V1ConfigMap;
2020
import io.kubernetes.client.spring.extended.manifests.annotation.FromConfigMap;

0 commit comments

Comments
 (0)