28
28
import org .elasticsearch .ExceptionsHelper ;
29
29
import org .elasticsearch .action .index .IndexRequest ;
30
30
import org .elasticsearch .common .bytes .BytesReference ;
31
- import org .elasticsearch .common .collect .ImmutableOpenMap ;
32
31
import org .elasticsearch .common .logging .Loggers ;
33
32
import org .elasticsearch .common .lucene .Lucene ;
34
33
import org .elasticsearch .common .lucene .index .ElasticsearchDirectoryReader ;
66
65
import java .io .IOException ;
67
66
import java .io .UncheckedIOException ;
68
67
import java .util .Arrays ;
68
+ import java .util .Collections ;
69
69
import java .util .Comparator ;
70
70
import java .util .HashMap ;
71
71
import java .util .HashSet ;
@@ -843,9 +843,9 @@ protected void fillSegmentStats(SegmentReader segmentReader, boolean includeSegm
843
843
}
844
844
}
845
845
846
- private ImmutableOpenMap <String , SegmentsStats .FileStats > getSegmentFileSizes (SegmentReader segmentReader ) {
846
+ private Map <String , SegmentsStats .FileStats > getSegmentFileSizes (SegmentReader segmentReader ) {
847
847
try {
848
- final ImmutableOpenMap . Builder <String , SegmentsStats .FileStats > files = ImmutableOpenMap . builder ();
848
+ Map <String , SegmentsStats .FileStats > files = new HashMap <> ();
849
849
final SegmentCommitInfo segmentCommitInfo = segmentReader .getSegmentInfo ();
850
850
for (String fileName : segmentCommitInfo .files ()) {
851
851
String fileExtension = IndexFileNames .getExtension (fileName );
@@ -857,11 +857,11 @@ private ImmutableOpenMap<String, SegmentsStats.FileStats> getSegmentFileSizes(Se
857
857
logger .warn (() -> "Error when retrieving file length for [" + fileName + "]" , ioe );
858
858
} catch (AlreadyClosedException ace ) {
859
859
logger .warn (() -> "Error when retrieving file length for [" + fileName + "], directory is closed" , ace );
860
- return ImmutableOpenMap .of ();
860
+ return Map .of ();
861
861
}
862
862
}
863
863
}
864
- return files . build ( );
864
+ return Collections . unmodifiableMap ( files );
865
865
} catch (IOException e ) {
866
866
logger .warn (
867
867
() -> format (
@@ -871,7 +871,7 @@ private ImmutableOpenMap<String, SegmentsStats.FileStats> getSegmentFileSizes(Se
871
871
),
872
872
e
873
873
);
874
- return ImmutableOpenMap .of ();
874
+ return Map .of ();
875
875
}
876
876
}
877
877
0 commit comments