File tree Expand file tree Collapse file tree
server/src/main/java/org/elasticsearch/common/cache Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -653,15 +653,15 @@ public void remove() {
653653
654654 /**
655655 * Performs an action for each cache entry in the cache. While iterating over the cache entries this method is protected from mutations
656- * that occurs within the same cache segment by acquiring the segment's writing lock during all the iteration. As such, the specified
656+ * that occurs within the same cache segment by acquiring the segment's read lock during all the iteration. As such, the specified
657657 * consumer should not try to modify the cache. Modifications that occur in already traveled segments won't been seen by the consumer
658658 * but modification that occur in non yet traveled segments should be.
659659 *
660660 * @param consumer the {@link Consumer}
661661 */
662662 public void forEach (BiConsumer <K , V > consumer ) {
663663 for (CacheSegment <K , V > segment : segments ) {
664- try (ReleasableLock ignored = segment .writeLock .acquire ()) {
664+ try (ReleasableLock ignored = segment .readLock .acquire ()) {
665665 for (CompletableFuture <Entry <K , V >> future : segment .map .values ()) {
666666 try {
667667 if (future != null && future .isDone ()) {
You can’t perform that action at this time.
0 commit comments