if (!metadata.isUnused()) {
allBinaryUsedKeys.add(binaryKeyFromCacheKey(key));
}
}
PersistenceManager persistenceManager = metadataCache.getAdvancedCache().getComponentRegistry()
.getComponent(PersistenceManager.class);
if (persistenceManager != null) {
// process cache loader content
CacheLoaderTask<Object, Object> task = new CacheLoaderTask<Object, Object>() {
@Override
public void processEntry( MarshalledEntry<Object, Object> marshalledEntry,
AdvancedCacheLoader.TaskContext taskContext ) {
Object key = marshalledEntry.getKey();
if (!(key instanceof String)) {
return;
}
String keyString = key.toString();
if (!isMetadataKey(keyString)) {
return;
}
BinaryKey binaryKey = binaryKeyFromCacheKey(keyString);
if (allBinaryUsedKeys.contains(binaryKey)) {
return;
}
Metadata metadata = metadataCache.get(key);
if (!metadata.isUnused()) {
allBinaryUsedKeys.add(binaryKey);
}
}
};
persistenceManager.processOnAllStores(AdvancedCacheLoader.KeyFilter.LOAD_ALL_FILTER, task, false, false);
}
} catch (Exception ex) {
throw new BinaryStoreException(JcrI18n.problemsGettingBinaryKeysFromBinaryStore.text(ex.getCause().getMessage()));
}
return allBinaryUsedKeys;