int numFetchPersistentState = 0;
for (StoreConfigurationBuilder<?, ?> b : stores) {
b.validate();
StoreConfiguration storeConfiguration = b.create();
if (storeConfiguration.shared() && storeConfiguration.singletonStore().enabled()) {
throw new CacheConfigurationException("Invalid cache loader configuration for " + storeConfiguration.getClass().getSimpleName()
+ " If a cache loader is configured as a singleton, the cache loader cannot be shared in a cluster!");
}
if (storeConfiguration.fetchPersistentState())
numFetchPersistentState++;
}
if (numFetchPersistentState > 1)
throw new CacheConfigurationException("Maximum one store can be set to 'fetchPersistentState'!");
}