use of org.infinispan.configuration.cache.Configuration in project wildfly by wildfly.
the class InfinispanBatcherFactoryTestCase method nonTransactional.
@Test
public void nonTransactional() {
AdvancedCache<Object, Object> cache = mock(AdvancedCache.class);
Configuration configuration = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL).build();
when(cache.getAdvancedCache()).thenReturn(cache);
when(cache.getCacheConfiguration()).thenReturn(configuration);
Batcher<TransactionBatch> batcher = this.factory.createBatcher(cache);
assertNull(batcher);
}
use of org.infinispan.configuration.cache.Configuration in project wildfly by wildfly.
the class InfinispanBatcherFactoryTestCase method transactional.
@Test
public void transactional() {
AdvancedCache<Object, Object> cache = mock(AdvancedCache.class);
Configuration configuration = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.TRANSACTIONAL).build();
when(cache.getAdvancedCache()).thenReturn(cache);
when(cache.getCacheConfiguration()).thenReturn(configuration);
Batcher<TransactionBatch> batcher = this.factory.createBatcher(cache);
assertNotNull(batcher);
}
use of org.infinispan.configuration.cache.Configuration in project wildfly by wildfly.
the class CacheConfigurationBuilder method configure.
@Override
public Builder<Configuration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
boolean enabled = STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean();
this.statistics = new ConfigurationBuilder().jmxStatistics().enabled(enabled).available(enabled).create();
this.global = new InjectedValueDependency<>(InfinispanRequirement.CONFIGURATION.getServiceName(context, this.containerName), GlobalConfiguration.class);
this.builder = new org.wildfly.clustering.infinispan.spi.service.ConfigurationBuilder(CONFIGURATION.getServiceName(context.getCurrentAddress()), this.containerName, this.cacheName, this.andThen(builder -> {
CacheMode mode = builder.clustering().cacheMode();
if (mode.isSynchronous() && (this.transaction.getValue().lockingMode() == LockingMode.OPTIMISTIC) && (this.locking.getValue().isolationLevel() == IsolationLevel.REPEATABLE_READ)) {
builder.locking().writeSkewCheck(true);
builder.versioning().enable().scheme(VersioningScheme.SIMPLE);
}
GroupsConfigurationBuilder groupsBuilder = builder.clustering().hash().groups().enabled();
this.module.getValue().loadService(Grouper.class).forEach(grouper -> groupsBuilder.addGrouper(grouper));
})).configure(context);
return this;
}
use of org.infinispan.configuration.cache.Configuration in project indy by Commonjava.
the class StorageFileIOTest method setup.
@Before
public void setup() throws IOException {
storageRoot = temp.newFolder("data");
Properties storageProps = new Properties();
storageProps.setProperty(StorageFileIO.STORAGE_ROOT_DIR, storageRoot.getAbsolutePath());
Configuration dataConfig = new ConfigurationBuilder().persistence().passivation(true).addStore(CustomStoreConfigurationBuilder.class).customStoreClass(StorageFileIO.class).properties(storageProps).build();
String dataName = name.getMethodName() + "-data";
CACHE_MANAGER.defineConfiguration(dataName, dataConfig);
Configuration mdConfig = new ConfigurationBuilder().build();
String metadataName = name.getMethodName() + "-metadata";
CACHE_MANAGER.defineConfiguration(metadataName, mdConfig);
dataCache = CACHE_MANAGER.getCache(dataName);
fs = new GridFilesystem(dataCache, CACHE_MANAGER.getCache(metadataName));
}
use of org.infinispan.configuration.cache.Configuration in project adeptj-modules by AdeptJ.
the class InfinispanCacheProvider method initInfinispan.
protected void initInfinispan() {
long startTime = System.nanoTime();
if (this.cacheManager == null) {
Configuration defaultConfiguration = new ConfigurationBuilder().simpleCache(true).eviction().strategy(EvictionStrategy.LRU).type(EvictionType.COUNT).size(1000l).expiration().lifespan(60, TimeUnit.MINUTES).maxIdle(30, TimeUnit.MINUTES).build();
this.cacheManager = new DefaultCacheManager(defaultConfiguration);
LOGGER.info("Infinispan initialization took: [{}] ms!!", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime));
}
}
Aggregations