@SuppressWarnings("deprecation") @Override public CustomStoreConfiguration create() { return new CustomStoreConfiguration(this.attributes.protect(), this.async.create(), this.singletonStore.create()); }
@Override public PersistenceConfiguration get() { B builder = new ConfigurationBuilder().persistence() .passivation(this.passivation) .addStore(this.builderClass) .fetchPersistentState(this.fetchState) .maxBatchSize(this.maxBatchSize) .preload(this.preload) .purgeOnStartup(this.purge) .shared(this.shared) .withProperties(this.properties) ; this.accept(builder); return builder.async().read(this.async.get()).persistence().create(); } }
@Override public AsyncStoreConfiguration get() { return new ConfigurationBuilder().persistence().addSingleFileStore().async() .modificationQueueSize(this.queueSize) .threadPoolSize(this.poolSize) .create(); }
case ENABLED: if (Boolean.parseBoolean(value)) { storeBuilder.async().enable(); } else { storeBuilder.async().disable(); storeBuilder.async().flushLockTimeout(Long.parseLong(value)); break; case MODIFICATION_QUEUE_SIZE: storeBuilder.async().modificationQueueSize(Integer.parseInt(value)); break; case SHUTDOWN_TIMEOUT: storeBuilder.async().shutdownTimeout(Long.parseLong(value)); break; case THREAD_POOL_SIZE: storeBuilder.async().threadPoolSize(Integer.parseInt(value)); break; default:
if (async) { ModelNode writeBehind = store.get(ModelKeys.WRITE_BEHIND, ModelKeys.WRITE_BEHIND_NAME); storeConfigurationBuilder.async().enable() .modificationQueueSize(StoreWriteBehindResource.MODIFICATION_QUEUE_SIZE.resolveModelAttribute(context, writeBehind).asInt()) .threadPoolSize(StoreWriteBehindResource.THREAD_POOL_SIZE.resolveModelAttribute(context, writeBehind).asInt())
private Cache<Object, Object> createManagerAndGetCache(boolean failSilently, int queueSize) { GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build(); ConfigurationBuilder cb = TestCacheManagerFactory.getDefaultCacheConfiguration(false); Configuration config = cb.persistence().availabilityInterval(AVAILABILITY_INTERVAL) .addStore(DummyInMemoryStoreConfigurationBuilder.class) .async().enable().modificationQueueSize(queueSize).failSilently(failSilently) .build(); return new DefaultCacheManager(globalConfiguration, config).getCache(); }
public void testAsyncStoreDisabling() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).async().enable(); disableWithConfiguration(builder); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder config = getDefaultStandaloneCacheConfig(false); config .persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class) .storeName(this.getClass().getName()) .slow(true) .async().enable().threadPoolSize(1) .build(); EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createCacheManager(config); cacheManager.defineConfiguration(CACHE_NAME, config.build()); return cacheManager; }
private void enableTestJdbcStorage(ConfigurationBuilder configuration) throws Exception { configuration .persistence() .passivation(false) .addSingleFileStore() .preload(false) .shared(false) .location(tmpDirectory) .async() .enable() .threadPoolSize(1); }
.addStore(new LockableStoreConfigurationBuilder(builder.persistence())); lcscsBuilder.async() .modificationQueueSize(10) .threadPoolSize(3); lcscsBuilder.async() .shutdownTimeout(50);
public void testDocumentationPersistenceConfiguration() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.persistence() .passivation(false) .addSingleFileStore() .fetchPersistentState(true) .shared(false) .preload(true) .ignoreModifications(false) .purgeOnStartup(false) .location(System.getProperty("java.io.tmpdir")) .async() .enabled(true) .flushLockTimeout(15000) .threadPoolSize(5) .singleton() .enabled(true) .pushStateWhenCoordinator(true) .pushStateTimeout(20000); }
@Override public Builder<?> read(LuceneLoaderConfiguration template) { this.autoChunkSize = template.autoChunkSize(); this.location = template.location(); // AbstractStore-specific configuration this.fetchPersistentState = template.fetchPersistentState(); this.ignoreModifications = template.ignoreModifications(); this.properties = template.properties(); this.purgeOnStartup = template.purgeOnStartup(); this.async.read(template.async()); this.singletonStore.read(template.singletonStore()); this.preload = template.preload(); return this; }
@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); } }
private static ConfigurationBuilder config(boolean passivation, int threads) { ConfigurationBuilder config = new ConfigurationBuilder(); config.expiration().wakeUpInterval(100); config.memory().size(1); config.persistence() .passivation(passivation) .addStore(LockableStoreConfigurationBuilder.class) .async() .enabled(USE_ASYNC_STORE) .threadPoolSize(threads); return config; }
case ENABLED: if (Boolean.parseBoolean(value)) { storeBuilder.async().enable(); } else { storeBuilder.async().disable(); storeBuilder.async().flushLockTimeout(Long.parseLong(value)); break; case MODIFICATION_QUEUE_SIZE: storeBuilder.async().modificationQueueSize(Integer.parseInt(value)); break; case SHUTDOWN_TIMEOUT: storeBuilder.async().shutdownTimeout(Long.parseLong(value)); break; case THREAD_POOL_SIZE: storeBuilder.async().threadPoolSize(Integer.parseInt(value)); break; default:
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cfg = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); cfg.persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class) .slow(true) .storeName(shared ? ReplAsyncStoreTest.class.getName() : null) .shared(shared) .async().enable(); createClusteredCaches(3, CACHE_NAME, cfg); waitForClusterToForm(CACHE_NAME); }
private void createStore(boolean slow) throws PersistenceException { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); DummyInMemoryStoreConfigurationBuilder dummyCfg = builder .persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class) .storeName(AsyncStoreTest.class.getName()); dummyCfg .async() .enable() .threadPoolSize(10); dummyCfg.slow(slow); InitializationContext ctx = PersistenceMockUtil.createContext(getClass().getSimpleName(), builder.build(), marshaller); DummyInMemoryStore underlying = new DummyInMemoryStore(); underlying.init(ctx); underlying.start(); writer = new SlowAdvancedAsyncCacheWriter(underlying); writer.init(ctx); writer.start(); loader = new AdvancedAsyncCacheLoader(underlying, writer.getState()); loader.init(ctx); loader.start(); eventually(writer::isAvailable); }
@Override public JdbmCacheStoreConfigurationBuilder read(JdbmCacheStoreConfiguration template) { this.comparatorClassName = template.comparatorClassName(); this.expiryQueueSize = template.expiryQueueSize(); this.location = template.location(); // AbstractStore-specific configuration fetchPersistentState = template.fetchPersistentState(); ignoreModifications = template.ignoreModifications(); properties = template.properties(); purgeOnStartup = template.purgeOnStartup(); purgeSynchronously = template.purgeSynchronously(); async.read(template.async()); singletonStore.read(template.singletonStore()); return this; } }