public CacheMode getEffectiveCacheMode(final CacheMode cacheModeParam) {
assert cacheModeParam != null;
if (cacheModeParam != CacheMode.DYNAMIC) {
return cacheModeParam;
}
final CacheModeStrategy strategy = (cacheModeStrategy != null) ?
cacheModeStrategy :
envImpl.getDefaultCacheModeStrategy();
if (strategy == null) {
throw new IllegalStateException
("CacheMode.DYNAMIC may not be used without also configuring" +
" a CacheModeStrategy for the Database or Environment.");
}
final CacheMode dynamicMode = strategy.getCacheMode();
if (dynamicMode == null || dynamicMode == CacheMode.DYNAMIC) {
throw new IllegalArgumentException
("" + dynamicMode + " was illegally returned by " +
strategy.getClass().getName());
}
return dynamicMode;
}