protected < K , V > void loadAllEntries ( final Set < MarshallableEntry < K , V > > entriesCollector , final int maxEntries , MarshallableEntryFactory < K , V > entryFactory ) { int existingElements = entriesCollector . size ( ) ; int toLoadElements = maxEntries - existingElements ; if ( toLoadElements <= 0 ) { return ; } HashSet < IndexScopedKey > keysCollector = new HashSet <> ( ) ; loadSomeKeys ( keysCollector , Collections . EMPTY_SET , toLoadElements ) ; for ( IndexScopedKey key : keysCollector ) { Object value = load ( key ) ; if ( value != null ) { MarshallableEntry < K , V > cacheEntry = entryFactory . create ( key , value ) ; entriesCollector . add ( cacheEntry ) ; } } }
Loads all entries from the CacheLoader ; considering this is actually a Lucene index that s going to transform segments in entries in a specific order simplest entries first .