Skip to content

Commit 8b48c1d

Browse files
csvirimetacosm
authored andcommitted
fix: format
1 parent 49504b7 commit 8b48c1d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/ExternalResourceCachingEventSource.java

+12-9
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,25 @@
1818
* <p>
1919
* There are two related concepts to understand:
2020
* <ul>
21-
* <li>CacheKeyMapper - maps/extracts a key used to reference the associated resource in the cache</li>
22-
* <li>Object equals usage - compares if the two resources are the same or same version.</li>
21+
* <li>{@link CacheKeyMapper} - maps/extracts a key used to reference the associated resource in the
22+
* cache</li>
23+
* <li>External resources <strong>must</strong> properly implement {@link Object#equals(Object)} as
24+
* the cache uses {@code equals} to check if the resource has changed</li>
2325
* </ul>
24-
*
25-
* When a resource is added for a primary resource its key is used to put in a map. Equals is used
26-
* to compare if it's still the same resource, or an updated version of it. Event is emitted only if
27-
* a new resource(s) is received or actually updated or deleted. Delete is detected by a missing
28-
* key.
26+
* <p>
27+
* When a resource is added for a primary resource its key is used to put in a map.
28+
* {@link Object#equals(Object)} is used to compare if it's still the same resource, or an updated
29+
* version of it. Event is emitted only if a new resource(s) is received or actually updated or
30+
* deleted. Delete is detected by a missing key.
2931
*
3032
* @param <R> type of polled external secondary resource
3133
* @param <P> primary resource
3234
*/
3335
public abstract class ExternalResourceCachingEventSource<R, P extends HasMetadata>
3436
extends AbstractResourceEventSource<R, P> implements RecentOperationCacheFiller<R> {
3537

36-
private static Logger log = LoggerFactory.getLogger(ExternalResourceCachingEventSource.class);
38+
private static final Logger log =
39+
LoggerFactory.getLogger(ExternalResourceCachingEventSource.class);
3740

3841
protected final CacheKeyMapper<R> cacheKeyMapper;
3942

@@ -89,7 +92,7 @@ protected synchronized void handleResources(Map<ResourceID, Set<R>> allNewResour
8992
var toDelete = cache.keySet().stream().filter(k -> !allNewResources.containsKey(k))
9093
.collect(Collectors.toList());
9194
toDelete.forEach(this::handleDelete);
92-
allNewResources.forEach((primaryID, resources) -> handleResources(primaryID, resources));
95+
allNewResources.forEach(this::handleResources);
9396
}
9497

9598
protected synchronized void handleResources(ResourceID primaryID, Set<R> newResources,

0 commit comments

Comments
 (0)