use of org.infinispan.configuration.cache.StoreConfiguration in project indy by Commonjava.
the class StorageFileIO method init.
@Override
public void init(InitializationContext ctx) {
StoreConfiguration configuration = ctx.getConfiguration();
Properties properties = configuration.properties();
storageRoot = properties.getProperty(STORAGE_ROOT_DIR);
if (storageRoot == null) {
throw new RuntimeException("No " + STORAGE_ROOT_DIR + " property provided for cache! Cannot initialize " + getClass().getName());
}
}
use of org.infinispan.configuration.cache.StoreConfiguration in project wildfly by wildfly.
the class CustomStoreServiceConfigurator method get.
@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);
}
}
use of org.infinispan.configuration.cache.StoreConfiguration in project wildfly by wildfly.
the class InfinispanSessionManager method stop.
@Override
public void stop() {
if (!this.properties.isPersistent()) {
PersistenceConfiguration persistence = this.cache.getCacheConfiguration().persistence();
// Don't passivate sessions on stop if we will purge the store on startup
if (persistence.passivation() && !persistence.stores().stream().allMatch(StoreConfiguration::purgeOnStartup)) {
try (Stream<Key<String>> stream = this.cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL, Flag.SKIP_CACHE_LOAD, Flag.SKIP_LOCKING).keySet().stream()) {
stream.filter(SessionCreationMetaDataKeyFilter.INSTANCE).forEach(this.cache::evict);
}
}
}
this.expirationRegistration.close();
if (this.recorder != null) {
this.cache.removeListener(this);
}
this.identifierFactory.stop();
this.contextRegistration.close();
}
Aggregations