final Store store;
if (isTerracottaClustered()) {
final Consistency consistency = getCacheConfiguration().getTerracottaConfiguration().getConsistency();
final boolean coherent = getCacheConfiguration().getTerracottaConfiguration().isCoherent();
if (getCacheConfiguration().isOverflowToOffHeap()) {
throw new InvalidConfigurationException(
"Terracotta clustered caches with local overflow to offheap are not supported yet."
+ " You can fix this by disabling overflow to offheap for clustered caches.");
}
if (getCacheConfiguration().getTerracottaConfiguration().isSynchronousWrites() && consistency == Consistency.EVENTUAL) {
throw new InvalidConfigurationException(
"Terracotta clustered caches with eventual consistency and synchronous writes are not supported yet."
+ " You can fix this by either making the cache in 'strong' consistency mode "
+ "(<terracotta consistency=\"strong\"/>) or turning off synchronous writes.");
}
if (getCacheConfiguration().getTransactionalMode().isTransactional() && consistency == Consistency.EVENTUAL) {
throw new InvalidConfigurationException("Consistency should be " + Consistency.STRONG
+ " when cache is configured with transactions enabled. "
+ "You can fix this by either making the cache in 'strong' consistency mode "
+ "(<terracotta consistency=\"strong\"/>) or turning off transactions.");
}
if (getCacheConfiguration().getTransactionalMode().isTransactional()
&& !getCacheConfiguration().getTransactionalMode().equals(CacheConfiguration.TransactionalMode.XA_STRICT)
&& getCacheConfiguration().getTerracottaConfiguration().isNonstopEnabled()) {
LOG.warn("Cache: " + configuration.getName() + " configured both NonStop and transactional non xa_strict."
+ " NonStop features won't work for this cache!");
}
if ((coherent && consistency == Consistency.EVENTUAL) || (!coherent && consistency == Consistency.STRONG)) {
throw new InvalidConfigurationException("Coherent and consistency attribute values are conflicting. "
+ "Please remove the coherent attribute as its deprecated.");
}
int maxConcurrency = Integer.getInteger(EHCACHE_CLUSTERREDSTORE_MAX_CONCURRENCY_PROP,
DEFAULT_EHCACHE_CLUSTERREDSTORE_MAX_CONCURRENCY);
if (getCacheConfiguration().getTerracottaConfiguration().getConcurrency() > maxConcurrency) {
throw new InvalidConfigurationException("Maximum supported concurrency for Terracotta clustered caches is "
+ maxConcurrency + ". Please reconfigure cache '" + getName() + "' with concurrency value <= " + maxConcurrency
+ " or use system property '" + EHCACHE_CLUSTERREDSTORE_MAX_CONCURRENCY_PROP + "' to override the default");
}
if (getCacheConfiguration().getMaxElementsOnDisk() == 0) {
LOG.warn("Performance may degrade and server disks could run out of space!\nThe distributed cache {} does not have " +