@Test public void testSynchronousWritesPersistenceConfiguration() { CacheConfiguration configuration = new CacheConfiguration("Test", 10).persistence(new PersistenceConfiguration() .strategy(Strategy.LOCALTEMPSWAP).synchronousWrites(true)); try { cacheManager.addCache(new Cache(configuration)); fail("Expected InvalidConfigurationException"); } catch (InvalidConfigurationException e) { assertThat(e.getMessage(), containsString("synchronousWrites")); } finally { cacheManager.removeCache("Test"); } configuration = new CacheConfiguration("Test", 10).persistence(new PersistenceConfiguration() .strategy(Strategy.NONE).synchronousWrites(true)); try { cacheManager.addCache(new Cache(configuration)); fail("Expected InvalidConfigurationException"); } catch (InvalidConfigurationException e) { assertThat(e.getMessage(), containsString("synchronousWrites")); } finally { cacheManager.removeCache("Test"); } configuration = new CacheConfiguration("Test", 10).persistence(new PersistenceConfiguration() .strategy(Strategy.LOCALRESTARTABLE).synchronousWrites(true)); try { cacheManager.addCache(new Cache(configuration)); fail("Expected CacheException"); } catch (CacheException e) { assertThat(e.getMessage(), containsString("enterprise")); } finally { cacheManager.removeCache("Test"); } }
public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; }
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } }
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration();  CacheConfiguration(String name, int maxEntriesLocalHeap); }
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration();  CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String name); final CacheConfiguration name(String name); final void setLogging(boolean enable); final void setOverflowToOffHeap(boolean overflowToOffHeap); CacheConfiguration overflowToOffHeap(boolean overflowToOffHeap); void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicyConfiguration); CacheConfiguration sizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicyConfiguration); void addPersistence(PersistenceConfiguration persistenceConfiguration); CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration); @Deprecated final void setMaxMemoryOffHeap(String maxMemoryOffHeap); @Deprecated CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap); final CacheConfiguration logging(boolean enable); @Deprecated final void setMaxElementsInMemory(int maxElementsInMemory); final void setMaxEntriesLocalHeap(long maxEntriesLocalHeap); @Deprecated final CacheConfiguration maxElementsInMemory(int maxElementsInMemory); final CacheConfiguration maxEntriesLocalHeap(int maxElementsInMemory); final void setCacheLoaderTimeoutMillis(long cacheLoaderTimeoutMillis); CacheConfiguration timeoutMillis(long timeoutMillis); final void setMemoryStoreEvictionPolicy(String memoryStoreEvictionPolicy); final CacheConfiguration memoryStoreEvictionPolicy(String memoryStoreEvictionPolicy); final void setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy); final CacheConfiguration memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy); final void setClearOnFlush(boolean clearOnFlush); final CacheConfiguration clearOnFlush(boolean clearOnFlush); final void setEternal(boolean eternal); final CacheConfiguration eternal(boolean eternal); final void setTimeToIdleSeconds(long timeToIdleSeconds); final CacheConfiguration timeToIdleSeconds(long timeToIdleSeconds); final void setTimeToLiveSeconds(long timeToLiveSeconds); final CacheConfiguration timeToLiveSeconds(long timeToLiveSeconds); @Deprecated final void setOverflowToDisk(boolean overflowToDisk); @Deprecated final CacheConfiguration overflowToDisk(boolean overflowToDisk); @Deprecated final void setDiskPersistent(boolean diskPersistent); @Deprecated final CacheConfiguration diskPersistent(boolean diskPersistent); void setDiskSpoolBufferSizeMB(int diskSpoolBufferSizeMB); final CacheConfiguration diskSpoolBufferSizeMB(int diskSpoolBufferSizeMB); void setDiskAccessStripes(int stripes); final CacheConfiguration diskAccessStripes(int stripes); void setMaxElementsOnDisk(int maxElementsOnDisk); void setMaxEntriesInCache(long maxEntriesInCache); void setMaxEntriesLocalDisk(long maxEntriesLocalDisk); final CacheConfiguration maxElementsOnDisk(int maxElementsOnDisk); final CacheConfiguration maxEntriesInCache(long maxEntriesInCache); final CacheConfiguration maxEntriesLocalDisk(int maxElementsOnDisk); final void setDiskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds); final CacheConfiguration diskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds); void freezeConfiguration(); boolean isFrozen(); ReadWriteCopyStrategy<Element> getCopyStrategy(); CacheConfiguration copyOnRead(boolean copyOnRead); boolean isCopyOnRead(); void setCopyOnRead(final boolean copyOnRead); CacheConfiguration copyOnWrite(boolean copyOnWrite); boolean isCopyOnWrite(); void setCopyOnWrite(final boolean copyOnWrite); void addCopyStrategy(CopyStrategyConfiguration copyStrategyConfiguration); void addElementValueComparator(ElementValueComparatorConfiguration elementValueComparatorConfiguration); final void addSearchable(Searchable searchable); long getMaxBytesLocalHeap(); void setMaxBytesLocalHeap(final String maxBytesHeap); void setMaxBytesLocalHeap(final Long maxBytesHeap); CacheConfiguration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalOffHeap(); String getMaxBytesLocalOffHeapAsString(); void setMaxBytesLocalOffHeap(final String maxBytesOffHeap); Integer getMaxBytesLocalOffHeapPercentage(); Integer getMaxBytesLocalHeapPercentage(); String getMaxBytesLocalHeapAsString(); Integer getMaxBytesLocalDiskPercentage(); void setMaxBytesLocalOffHeap(final Long maxBytesOffHeap); CacheConfiguration maxBytesLocalOffHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalDisk(); String getMaxBytesLocalDiskAsString(); void setMaxBytesLocalDisk(final String maxBytesDisk); void setMaxBytesLocalDisk(final Long maxBytesDisk); CacheConfiguration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit); void setDynamicAttributesExtractor(DynamicAttributesExtractor extractor); CacheConfiguration dynamicAttributeExtractor(DynamicAttributesExtractor extractor); CopyStrategyConfiguration getCopyStrategyConfiguration(); ElementValueComparatorConfiguration getElementValueComparatorConfiguration(); boolean isMaxBytesLocalHeapPercentageSet(); boolean isMaxBytesLocalOffHeapPercentageSet(); boolean isMaxBytesLocalDiskPercentageSet(); void setupFor(final CacheManager cacheManager); void setupFor(final CacheManager cacheManager, final boolean register, final String parentCache); Collection<ConfigError> validate(final Configuration configuration); boolean isCountBasedTuned(); boolean isOverflowToOffHeapSet(); final void addCacheEventListenerFactory(CacheEventListenerFactoryConfiguration factory); final CacheConfiguration cacheEventListenerFactory(CacheEventListenerFactoryConfiguration factory); final void addCacheExtensionFactory(CacheExtensionFactoryConfiguration factory); final CacheConfiguration cacheExtensionFactory(CacheExtensionFactoryConfiguration factory); final void addBootstrapCacheLoaderFactory(BootstrapCacheLoaderFactoryConfiguration factory); final CacheConfiguration bootstrapCacheLoaderFactory(BootstrapCacheLoaderFactoryConfiguration factory); final void addCacheExceptionHandlerFactory(CacheExceptionHandlerFactoryConfiguration factory); final CacheConfiguration cacheExceptionHandlerFactory(CacheExceptionHandlerFactoryConfiguration factory); final void addCacheLoaderFactory(CacheLoaderFactoryConfiguration factory); final void addCacheDecoratorFactory(CacheDecoratorFactoryConfiguration factory); final CacheConfiguration cacheLoaderFactory(CacheLoaderFactoryConfiguration factory); final void addTerracotta(TerracottaConfiguration terracottaConfiguration); final void addPinning(PinningConfiguration pinningConfiguration); final CacheConfiguration pinning(PinningConfiguration pinningConfiguration); final CacheConfiguration terracotta(TerracottaConfiguration terracottaConfiguration); final CacheConfiguration searchable(Searchable searchable); final void addCacheWriter(CacheWriterConfiguration cacheWriterConfiguration); final CacheConfiguration cacheWriter(CacheWriterConfiguration cacheWriterConfiguration); final void setTransactionalMode(final String transactionalMode); final CacheConfiguration transactionalMode(String transactionalMode); final CacheConfiguration transactionalMode(TransactionalMode transactionalMode); @Deprecated final void setStatistics(boolean enabled); @Deprecated final CacheConfiguration statistics(boolean statistics); final boolean getStatistics(); void validateCompleteConfiguration(); void validateConfiguration(); String getName(); @Deprecated int getMaxElementsInMemory(); long getCacheLoaderTimeoutMillis(); int getMaxElementsOnDisk(); long getMaxEntriesInCache(); long getMaxEntriesLocalDisk(); long getMaxEntriesLocalHeap(); MemoryStoreEvictionPolicy getMemoryStoreEvictionPolicy(); boolean isClearOnFlush(); boolean isEternal(); long getTimeToIdleSeconds(); long getTimeToLiveSeconds(); @Deprecated boolean isOverflowToDisk(); @Deprecated boolean isDiskPersistent(); boolean isSearchable(); int getDiskSpoolBufferSizeMB(); long getDiskExpiryThreadIntervalSeconds(); int getDiskAccessStripes(); DynamicAttributesExtractor getDynamicExtractor(); boolean getLogging(); boolean isOverflowToOffHeap(); SizeOfPolicyConfiguration getSizeOfPolicyConfiguration(); PersistenceConfiguration getPersistenceConfiguration(); @Deprecated String getMaxMemoryOffHeap(); @Deprecated long getMaxMemoryOffHeapInBytes(); List getCacheEventListenerConfigurations(); List getCacheExtensionConfigurations(); List getCacheLoaderConfigurations(); List<CacheDecoratorFactoryConfiguration> getCacheDecoratorConfigurations(); BootstrapCacheLoaderFactoryConfiguration getBootstrapCacheLoaderFactoryConfiguration(); CacheExceptionHandlerFactoryConfiguration getCacheExceptionHandlerFactoryConfiguration(); TerracottaConfiguration getTerracottaConfiguration(); PinningConfiguration getPinningConfiguration(); CacheWriterConfiguration getCacheWriterConfiguration(); boolean isTerracottaClustered(); Consistency getTerracottaConsistency(); final TransactionalMode getTransactionalMode(); boolean isXaStrictTransactional(); boolean isLocalTransactional(); boolean isXaTransactional(); boolean addConfigurationListener(CacheConfigurationListener listener); boolean addDynamicSearchListener(DynamicSearchListener listener); boolean removeConfigurationListener(CacheConfigurationListener listener); void internalSetTimeToIdle(long timeToIdle); void internalSetTimeToLive(long timeToLive); void internalSetMemCapacity(int capacity); void internalSetMemCapacityInBytes(long capacity); void internalSetDiskCapacity(int capacity); void internalSetMaxEntriesInCache(int entries); void internalSetLogging(boolean logging); Map<String, SearchAttribute> getSearchAttributes(); Searchable getSearchable(); }
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration();  CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String name); final CacheConfiguration name(String name); final void setLogging(boolean enable); final void setOverflowToOffHeap(boolean overflowToOffHeap); CacheConfiguration overflowToOffHeap(boolean overflowToOffHeap); void addSizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicyConfiguration); CacheConfiguration sizeOfPolicy(SizeOfPolicyConfiguration sizeOfPolicyConfiguration); void addPersistence(PersistenceConfiguration persistenceConfiguration); CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration); @Deprecated final void setMaxMemoryOffHeap(String maxMemoryOffHeap); @Deprecated CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap); final CacheConfiguration logging(boolean enable); @Deprecated final void setMaxElementsInMemory(int maxElementsInMemory); final void setMaxEntriesLocalHeap(long maxEntriesLocalHeap); @Deprecated final CacheConfiguration maxElementsInMemory(int maxElementsInMemory); final CacheConfiguration maxEntriesLocalHeap(int maxElementsInMemory); final void setCacheLoaderTimeoutMillis(long cacheLoaderTimeoutMillis); CacheConfiguration timeoutMillis(long timeoutMillis); final void setMemoryStoreEvictionPolicy(String memoryStoreEvictionPolicy); final CacheConfiguration memoryStoreEvictionPolicy(String memoryStoreEvictionPolicy); final void setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy); final CacheConfiguration memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy memoryStoreEvictionPolicy); final void setClearOnFlush(boolean clearOnFlush); final CacheConfiguration clearOnFlush(boolean clearOnFlush); final void setEternal(boolean eternal); final CacheConfiguration eternal(boolean eternal); final void setTimeToIdleSeconds(long timeToIdleSeconds); final CacheConfiguration timeToIdleSeconds(long timeToIdleSeconds); final void setTimeToLiveSeconds(long timeToLiveSeconds); final CacheConfiguration timeToLiveSeconds(long timeToLiveSeconds); @Deprecated final void setOverflowToDisk(boolean overflowToDisk); @Deprecated final CacheConfiguration overflowToDisk(boolean overflowToDisk); @Deprecated final void setDiskPersistent(boolean diskPersistent); @Deprecated final CacheConfiguration diskPersistent(boolean diskPersistent); void setDiskSpoolBufferSizeMB(int diskSpoolBufferSizeMB); final CacheConfiguration diskSpoolBufferSizeMB(int diskSpoolBufferSizeMB); void setDiskAccessStripes(int stripes); final CacheConfiguration diskAccessStripes(int stripes); void setMaxElementsOnDisk(int maxElementsOnDisk); void setMaxEntriesInCache(long maxEntriesInCache); void setMaxEntriesLocalDisk(long maxEntriesLocalDisk); final CacheConfiguration maxElementsOnDisk(int maxElementsOnDisk); final CacheConfiguration maxEntriesInCache(long maxEntriesInCache); final CacheConfiguration maxEntriesLocalDisk(int maxElementsOnDisk); final void setDiskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds); final CacheConfiguration diskExpiryThreadIntervalSeconds(long diskExpiryThreadIntervalSeconds); void freezeConfiguration(); boolean isFrozen(); ReadWriteCopyStrategy<Element> getCopyStrategy(); CacheConfiguration copyOnRead(boolean copyOnRead); boolean isCopyOnRead(); void setCopyOnRead(final boolean copyOnRead); CacheConfiguration copyOnWrite(boolean copyOnWrite); boolean isCopyOnWrite(); void setCopyOnWrite(final boolean copyOnWrite); void addCopyStrategy(CopyStrategyConfiguration copyStrategyConfiguration); void addElementValueComparator(ElementValueComparatorConfiguration elementValueComparatorConfiguration); final void addSearchable(Searchable searchable); long getMaxBytesLocalHeap(); void setMaxBytesLocalHeap(final String maxBytesHeap); void setMaxBytesLocalHeap(final Long maxBytesHeap); CacheConfiguration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalOffHeap(); String getMaxBytesLocalOffHeapAsString(); void setMaxBytesLocalOffHeap(final String maxBytesOffHeap); Integer getMaxBytesLocalOffHeapPercentage(); Integer getMaxBytesLocalHeapPercentage(); String getMaxBytesLocalHeapAsString(); Integer getMaxBytesLocalDiskPercentage(); void setMaxBytesLocalOffHeap(final Long maxBytesOffHeap); CacheConfiguration maxBytesLocalOffHeap(final long amount, final MemoryUnit memoryUnit); long getMaxBytesLocalDisk(); String getMaxBytesLocalDiskAsString(); void setMaxBytesLocalDisk(final String maxBytesDisk); void setMaxBytesLocalDisk(final Long maxBytesDisk); CacheConfiguration maxBytesLocalDisk(final long amount, final MemoryUnit memoryUnit); void setDynamicAttributesExtractor(DynamicAttributesExtractor extractor); CacheConfiguration dynamicAttributeExtractor(DynamicAttributesExtractor extractor); CopyStrategyConfiguration getCopyStrategyConfiguration(); ElementValueComparatorConfiguration getElementValueComparatorConfiguration(); boolean isMaxBytesLocalHeapPercentageSet(); boolean isMaxBytesLocalOffHeapPercentageSet(); boolean isMaxBytesLocalDiskPercentageSet(); void setupFor(final CacheManager cacheManager); void setupFor(final CacheManager cacheManager, final boolean register, final String parentCache); Collection<ConfigError> validate(final Configuration configuration); boolean isCountBasedTuned(); boolean isOverflowToOffHeapSet(); final void addCacheEventListenerFactory(CacheEventListenerFactoryConfiguration factory); final CacheConfiguration cacheEventListenerFactory(CacheEventListenerFactoryConfiguration factory); final void addCacheExtensionFactory(CacheExtensionFactoryConfiguration factory); final CacheConfiguration cacheExtensionFactory(CacheExtensionFactoryConfiguration factory); final void addBootstrapCacheLoaderFactory(BootstrapCacheLoaderFactoryConfiguration factory); final CacheConfiguration bootstrapCacheLoaderFactory(BootstrapCacheLoaderFactoryConfiguration factory); final void addCacheExceptionHandlerFactory(CacheExceptionHandlerFactoryConfiguration factory); final CacheConfiguration cacheExceptionHandlerFactory(CacheExceptionHandlerFactoryConfiguration factory); final void addCacheLoaderFactory(CacheLoaderFactoryConfiguration factory); final void addCacheDecoratorFactory(CacheDecoratorFactoryConfiguration factory); final CacheConfiguration cacheLoaderFactory(CacheLoaderFactoryConfiguration factory); final void addTerracotta(TerracottaConfiguration terracottaConfiguration); final void addPinning(PinningConfiguration pinningConfiguration); final CacheConfiguration pinning(PinningConfiguration pinningConfiguration); final CacheConfiguration terracotta(TerracottaConfiguration terracottaConfiguration); final CacheConfiguration searchable(Searchable searchable); final void addCacheWriter(CacheWriterConfiguration cacheWriterConfiguration); final CacheConfiguration cacheWriter(CacheWriterConfiguration cacheWriterConfiguration); final void setTransactionalMode(final String transactionalMode); final CacheConfiguration transactionalMode(String transactionalMode); final CacheConfiguration transactionalMode(TransactionalMode transactionalMode); @Deprecated final void setStatistics(boolean enabled); @Deprecated final CacheConfiguration statistics(boolean statistics); final boolean getStatistics(); void validateCompleteConfiguration(); void validateConfiguration(); String getName(); @Deprecated int getMaxElementsInMemory(); long getCacheLoaderTimeoutMillis(); int getMaxElementsOnDisk(); long getMaxEntriesInCache(); long getMaxEntriesLocalDisk(); long getMaxEntriesLocalHeap(); MemoryStoreEvictionPolicy getMemoryStoreEvictionPolicy(); boolean isClearOnFlush(); boolean isEternal(); long getTimeToIdleSeconds(); long getTimeToLiveSeconds(); @Deprecated boolean isOverflowToDisk(); @Deprecated boolean isDiskPersistent(); boolean isSearchable(); int getDiskSpoolBufferSizeMB(); long getDiskExpiryThreadIntervalSeconds(); int getDiskAccessStripes(); DynamicAttributesExtractor getDynamicExtractor(); boolean getLogging(); boolean isOverflowToOffHeap(); SizeOfPolicyConfiguration getSizeOfPolicyConfiguration(); PersistenceConfiguration getPersistenceConfiguration(); @Deprecated String getMaxMemoryOffHeap(); @Deprecated long getMaxMemoryOffHeapInBytes(); List getCacheEventListenerConfigurations(); List getCacheExtensionConfigurations(); List getCacheLoaderConfigurations(); List<CacheDecoratorFactoryConfiguration> getCacheDecoratorConfigurations(); BootstrapCacheLoaderFactoryConfiguration getBootstrapCacheLoaderFactoryConfiguration(); CacheExceptionHandlerFactoryConfiguration getCacheExceptionHandlerFactoryConfiguration(); TerracottaConfiguration getTerracottaConfiguration(); PinningConfiguration getPinningConfiguration(); CacheWriterConfiguration getCacheWriterConfiguration(); boolean isTerracottaClustered(); Consistency getTerracottaConsistency(); final TransactionalMode getTransactionalMode(); boolean isXaStrictTransactional(); boolean isLocalTransactional(); boolean isXaTransactional(); boolean addConfigurationListener(CacheConfigurationListener listener); boolean addDynamicSearchListener(DynamicSearchListener listener); boolean removeConfigurationListener(CacheConfigurationListener listener); void internalSetTimeToIdle(long timeToIdle); void internalSetTimeToLive(long timeToLive); void internalSetMemCapacity(int capacity); void internalSetMemCapacityInBytes(long capacity); void internalSetDiskCapacity(int capacity); void internalSetMaxEntriesInCache(int entries); void internalSetLogging(boolean logging); Map<String, SearchAttribute> getSearchAttributes(); Searchable getSearchable(); static final boolean DEFAULT_CLEAR_ON_FLUSH; static final long DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS; static final int DEFAULT_SPOOL_BUFFER_SIZE; static final int DEFAULT_DISK_ACCESS_STRIPES; static final boolean DEFAULT_LOGGING; static final MemoryStoreEvictionPolicy DEFAULT_MEMORY_STORE_EVICTION_POLICY; static final CacheWriterConfiguration DEFAULT_CACHE_WRITER_CONFIGURATION; static final boolean DEFAULT_COPY_ON_READ; static final boolean DEFAULT_COPY_ON_WRITE; static final long DEFAULT_TTL; static final long DEFAULT_TTI; static final int DEFAULT_MAX_ELEMENTS_ON_DISK; static final long DEFAULT_MAX_ENTRIES_IN_CACHE; static final TransactionalMode DEFAULT_TRANSACTIONAL_MODE; static final boolean DEFAULT_STATISTICS; @Deprecated
    static final boolean DEFAULT_DISK_PERSISTENT; static final CopyStrategyConfiguration DEFAULT_COPY_STRATEGY_CONFIGURATION; static final long DEFAULT_MAX_BYTES_ON_HEAP; static final long DEFAULT_MAX_BYTES_OFF_HEAP; static final long DEFAULT_MAX_BYTES_ON_DISK; static final boolean DEFAULT_ETERNAL_VALUE; }