ServiceBuilder<Configuration> configBuilder = target.addService(cacheConfigurationServiceName, cacheConfigurationService)
.addDependency(containerServiceName, EmbeddedCacheManager.class, containerInjection)
.setInitialMode(ServiceController.Mode.PASSIVE)
;
Configuration config = builder.build();
if (config.invocationBatching().enabled()) {
cacheConfigurationDependencies.getTransactionManagerInjector().inject(BatchModeTransactionManager.getInstance());
} else if (config.transaction().transactionMode() == org.infinispan.transaction.TransactionMode.TRANSACTIONAL) {
configBuilder.addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER, TransactionManager.class, cacheConfigurationDependencies.getTransactionManagerInjector());
if (config.transaction().useSynchronization()) {
configBuilder.addDependency(TxnServices.JBOSS_TXN_SYNCHRONIZATION_REGISTRY, TransactionSynchronizationRegistry.class, cacheConfigurationDependencies.getTransactionSynchronizationRegistryInjector());
}
}
// add in any additional dependencies resulting from ModelNode parsing
for (Dependency<?> dependency: dependencies) {
this.addDependency(configBuilder, dependency);
}
// add an alias for the default cache
if (cacheName.equals(defaultCache)) {
configBuilder.addAliases(CacheConfigurationService.getServiceName(containerName, null));
}
newControllers.add(configBuilder.install());
log.debugf("Cache configuration service for %s installed for container %s", cacheName, containerName);
// now install the corresponding cache service (starts a configured cache)
CacheDependencies cacheDependencies = new CacheDependencies(containerInjection);
CacheService<Object, Object> cacheService = new CacheService<Object, Object>(cacheName, cacheDependencies);
ServiceBuilder<Cache<Object,Object>> cacheBuilder = target.addService(cacheServiceName, cacheService)
.addDependency(cacheConfigurationServiceName)
.setInitialMode(initialMode)
;
if (config.transaction().recovery().enabled()) {
cacheBuilder.addDependency(TxnServices.JBOSS_TXN_ARJUNA_RECOVERY_MANAGER, XAResourceRecoveryRegistry.class, cacheDependencies.getRecoveryRegistryInjector());
}
// add an alias for the default cache
if (cacheName.equals(defaultCache)) {