use of org.infinispan.persistence.spi.PersistenceException in project wildfly by wildfly.
the class HotRodStore method start.
@Override
public CompletionStage<Void> start(InitializationContext context) {
this.blockingManager = context.getBlockingManager();
HotRodStoreConfiguration configuration = context.getConfiguration();
RemoteCacheContainer container = configuration.remoteCacheContainer();
String cacheConfiguration = configuration.cacheConfiguration();
String cacheName = context.getCache().getName();
this.batchSize = configuration.maxBatchSize();
this.marshaller = context.getPersistenceMarshaller();
this.entryFactory = context.getMarshallableEntryFactory();
String templateName = (cacheConfiguration != null) ? cacheConfiguration : DefaultTemplate.DIST_SYNC.getTemplateName();
Consumer<RemoteCacheConfigurationBuilder> configurator = new Consumer<RemoteCacheConfigurationBuilder>() {
@Override
public void accept(RemoteCacheConfigurationBuilder builder) {
builder.forceReturnValues(false).transactionMode(TransactionMode.NONE).nearCacheMode(NearCacheMode.DISABLED).templateName(templateName);
}
};
container.getConfiguration().addRemoteCache(cacheName, configurator);
Runnable task = new Runnable() {
@Override
public void run() {
try {
HotRodStore.this.setRemoteCache(container, cacheName);
} catch (HotRodClientException ex) {
throw new PersistenceException(ex);
}
}
};
return this.blockingManager.runBlocking(task, "hotrod-store-start");
}
Aggregations