/** * @param keysCollector the Set where to add loaded keys to * @param keysToExclude Could be null! * @throws org.infinispan.persistence.spi.PersistenceException */ protected void loadAllKeys(final HashSet<IndexScopedKey> keysCollector, final Set<IndexScopedKey> keysToExclude) { loadSomeKeys(keysCollector, keysToExclude, Integer.MAX_VALUE); }
/** * 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. * * @param entriesCollector loaded entries are collected in this set * @param maxEntries to limit amount of entries loaded * @throws PersistenceException */ protected void loadAllEntries(final HashSet<MarshalledEntry> entriesCollector, final int maxEntries, StreamingMarshaller marshaller) { int existingElements = entriesCollector.size(); int toLoadElements = maxEntries - existingElements; if (toLoadElements <= 0) { return; } HashSet<IndexScopedKey> keysCollector = new HashSet<IndexScopedKey>(); loadSomeKeys(keysCollector, Collections.EMPTY_SET, toLoadElements); for (IndexScopedKey key : keysCollector) { Object value = load(key); if (value != null) { MarshalledEntry cacheEntry = new MarshalledEntryImpl(key, value, null, marshaller); 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. * * @param entriesCollector loaded entries are collected in this set * @param maxEntries to limit amount of entries loaded */ protected <K, V> void loadAllEntries(final Set<MarshalledEntry<K, V>> entriesCollector, final int maxEntries, StreamingMarshaller marshaller) { 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) { MarshalledEntry cacheEntry = new MarshalledEntryImpl(key, value, null, marshaller); 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. * * @param entriesCollector loaded entries are collected in this set * @param maxEntries to limit amount of entries loaded */ protected void loadAllEntries(final HashSet<MarshalledEntry> entriesCollector, final int maxEntries, StreamingMarshaller marshaller) { 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) { MarshalledEntry cacheEntry = new MarshalledEntryImpl(key, value, null, marshaller); entriesCollector.add(cacheEntry); } } }