public InfinispanCacheProperties(Configuration config) { this.transactional = config.transaction().transactionMode().isTransactional(); this.lockOnWrite = this.transactional && (config.transaction().lockingMode() == LockingMode.PESSIMISTIC); this.lockOnRead = this.lockOnWrite && (config.locking().isolationLevel() == IsolationLevel.REPEATABLE_READ); boolean clustered = config.clustering().cacheMode().needsStateTransfer(); boolean hasStore = config.persistence().usingStores(); this.marshalling = clustered || hasStore; this.persistent = clustered || (hasStore && !config.persistence().passivation()); }
@Override public PersistenceConfiguration get() { PersistenceConfiguration persistence = super.get(); StoreConfiguration store = persistence.stores().get(0); try { @SuppressWarnings("unchecked") Class<StoreConfigurationBuilder<?, ?>> storeClass = (Class<StoreConfigurationBuilder<?, ?>>) this.module.get().getClassLoader().loadClass(this.className).asSubclass(StoreConfigurationBuilder.class); return new ConfigurationBuilder().persistence().passivation(persistence.passivation()).addStore(storeClass) .async().read(store.async()) .fetchPersistentState(store.fetchPersistentState()) .preload(store.preload()) .purgeOnStartup(store.purgeOnStartup()) .shared(store.shared()) .withProperties(store.properties()) .persistence().create(); } catch (ClassNotFoundException | ClassCastException e) { throw InfinispanLogger.ROOT_LOGGER.invalidCacheStore(e, this.className); } }
final boolean passivationOn = cache.getCacheConfiguration().persistence().passivation();
public InfinispanCacheProperties(Configuration config) { this.transactional = config.transaction().transactionMode().isTransactional(); this.lockOnWrite = this.transactional && (config.transaction().lockingMode() == LockingMode.PESSIMISTIC); this.lockOnRead = this.lockOnWrite && (config.locking().isolationLevel() == IsolationLevel.REPEATABLE_READ); boolean clustered = config.clustering().cacheMode().needsStateTransfer(); boolean hasStore = config.persistence().usingStores(); this.marshalling = clustered || hasStore; this.persistent = clustered || (hasStore && !config.persistence().passivation()); }
public InfinispanCacheProperties(Configuration config) { this.transactional = config.transaction().transactionMode().isTransactional(); this.lockOnWrite = this.transactional && (config.transaction().lockingMode() == LockingMode.PESSIMISTIC); this.lockOnRead = this.lockOnWrite && (config.locking().isolationLevel() == IsolationLevel.REPEATABLE_READ); boolean clustered = config.clustering().cacheMode().needsStateTransfer(); boolean hasStore = config.persistence().usingStores(); this.marshalling = clustered || hasStore; this.persistent = clustered || (hasStore && !config.persistence().passivation()); }
@Override public PersistenceConfiguration get() { PersistenceConfiguration persistence = super.get(); StoreConfiguration store = persistence.stores().get(0); try { @SuppressWarnings("unchecked") Class<StoreConfigurationBuilder<?, ?>> storeClass = (Class<StoreConfigurationBuilder<?, ?>>) this.module.get().getClassLoader().loadClass(this.className).asSubclass(StoreConfigurationBuilder.class); return new ConfigurationBuilder().persistence().passivation(persistence.passivation()).addStore(storeClass) .async().read(store.async()) .fetchPersistentState(store.fetchPersistentState()) .preload(store.preload()) .purgeOnStartup(store.purgeOnStartup()) .shared(store.shared()) .withProperties(store.properties()) .persistence().create(); } catch (ClassNotFoundException | ClassCastException e) { throw InfinispanLogger.ROOT_LOGGER.invalidCacheStore(e, this.className); } }
public void testXmlConfig() throws IOException { InputStream configSTream = ConfigurationTest.class.getResourceAsStream("/config/leveldb-config-auto.xml"); ConfigurationBuilderHolder configHolder = new ParserRegistry().parse(configSTream); // check persistence attributes Configuration cacheConfig = configHolder.getNamedConfigurationBuilders().get("testCache").build(); assertFalse(cacheConfig.persistence().passivation()); assertEquals(cacheConfig.persistence().stores().size(), 1); // check generic store attributes StoreConfiguration cacheLoaderConfig = cacheConfig.persistence().stores().get(0); assertFalse(cacheLoaderConfig.shared()); assertTrue(cacheLoaderConfig.preload()); assertTrue(cacheLoaderConfig instanceof LevelDBStoreConfiguration); // check LevelDB store attributes LevelDBStoreConfiguration leveldbConfig = (LevelDBStoreConfiguration) cacheLoaderConfig; assertEquals("/tmp/leveldb/52/data", leveldbConfig.location()); assertEquals("/tmp/leveldb/52/expired", leveldbConfig.expiredLocation()); assertEquals(LevelDBStoreConfiguration.ImplementationType.AUTO, leveldbConfig.implementationType()); } }
assertTrue(!c.persistence().passivation()); assertEquals(1, c.persistence().stores().size());
assertEquals(10, c.expiration().lifespan()); assertEquals(10, c.expiration().maxIdle()); assertFalse(c.persistence().passivation()); SingleFileStoreConfiguration fileStore = (SingleFileStoreConfiguration) c.persistence().stores().get(0); assertFalse(fileStore.fetchPersistentState());