@Override public <K, V> Cache<K, V> getCache(LocalDistributableSessionManager manager) { ReplicationConfig config = manager.getReplicationConfig(); String containerName = config.getCacheName(); String templateCacheName = null; if ((containerName != null) && !containerName.isEmpty()) { String[] parts = containerName.split(DELIMITER); if (parts.length == 2) { containerName = parts[0]; templateCacheName = parts[1]; } } String cacheName = manager.getName(); EmbeddedCacheManager container = this.registry.getCacheContainer(containerName); this.applyOverrides(container.defineConfiguration(cacheName, templateCacheName, new Configuration()), config); return container.<K, V>getCache(cacheName); }
@Override public <T extends OutgoingDistributableSessionData> org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager) { Cache<String, Map<Object, Object>> sessionCache = this.sessionCacheSource.getCache(manager); SharedLocalYieldingClusterLockManager lockManager = this.lockManagerSource.getLockManager(sessionCache); TransactionManager tm = sessionCache.getAdvancedCache().getTransactionManager(); if (!(tm instanceof BatchModeTransactionManager)) { throw new IllegalStateException("Unexpected transaction manager type: " + ((tm != null) ? tm.getClass().getName() : "null")); } BatchingManager batchingManager = new BatchingManagerImpl(tm); SessionAttributeMarshaller marshaller = this.marshallerFactory.createMarshaller(manager); SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), marshaller); return new DistributedCacheManager<T>(manager, new AtomicMapCache<String, Object, Object>(sessionCache), this.jvmRouteCacheSource, lockManager, storage, batchingManager, this.invoker); }