Search in sources :

Example 1 with StoreConfiguration

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());
    }
}
Also used : StoreConfiguration(org.infinispan.configuration.cache.StoreConfiguration) Properties(java.util.Properties)

Example 2 with StoreConfiguration

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);
    }
}
Also used : PersistenceConfiguration(org.infinispan.configuration.cache.PersistenceConfiguration) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) StoreConfigurationBuilder(org.infinispan.configuration.cache.StoreConfigurationBuilder) StoreConfiguration(org.infinispan.configuration.cache.StoreConfiguration) StoreConfigurationBuilder(org.infinispan.configuration.cache.StoreConfigurationBuilder)

Example 3 with StoreConfiguration

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();
}
Also used : PersistenceConfiguration(org.infinispan.configuration.cache.PersistenceConfiguration) StoreConfiguration(org.infinispan.configuration.cache.StoreConfiguration) Key(org.wildfly.clustering.ee.Key)

Aggregations

StoreConfiguration (org.infinispan.configuration.cache.StoreConfiguration)3 PersistenceConfiguration (org.infinispan.configuration.cache.PersistenceConfiguration)2 Properties (java.util.Properties)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 StoreConfigurationBuilder (org.infinispan.configuration.cache.StoreConfigurationBuilder)1 Key (org.wildfly.clustering.ee.Key)1