[jboss-cvs] JBossAS SVN: r107093 - projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 26 20:41:42 EDT 2010


Author: pferraro
Date: 2010-07-26 20:41:42 -0400 (Mon, 26 Jul 2010)
New Revision: 107093

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerImpl.java
Log:
Informative ISE

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerImpl.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerImpl.java	2010-07-27 00:39:52 UTC (rev 107092)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerImpl.java	2010-07-27 00:41:42 UTC (rev 107093)
@@ -43,6 +43,8 @@
 import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
 import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
 import org.infinispan.transaction.tm.BatchModeTransactionManager;
+import org.jboss.ha.ispn.CacheContainerRegistry;
+import org.jboss.ha.ispn.DefaultCacheContainerRegistry;
 import org.jboss.logging.Logger;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.BatchingManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata;
@@ -80,7 +82,6 @@
    private static final Logger log = Logger.getLogger(DistributedCacheManagerImpl.class);
    
    private final LocalDistributableSessionManager manager;
-   private final CacheContainer container;
    private final SessionAttributeStorage<T> attributeStorage;
    private final CacheInvoker invoker;
    
@@ -88,10 +89,9 @@
    private BatchingManager batchingManager;
    private boolean passivationEnabled = false;
    
-   public DistributedCacheManagerImpl(LocalDistributableSessionManager manager, CacheContainer container, SessionAttributeStorage<T> attributeStorage, CacheInvoker invoker)
+   public DistributedCacheManagerImpl(LocalDistributableSessionManager manager, SessionAttributeStorage<T> attributeStorage, CacheInvoker invoker)
    {
       this.manager = manager;
-      this.container = container;
       this.attributeStorage = attributeStorage;
       this.invoker = invoker;
    }
@@ -99,6 +99,24 @@
    @Override
    public void start()
    {
+      String templateCacheName = this.manager.getReplicationConfig().getCacheName();
+      
+      String containerName = null;
+      
+      if (templateCacheName != null)
+      {
+         String[] parts = templateCacheName.split(":");
+         
+         if (parts.length == 2)
+         {
+            containerName = parts[0];
+            templateCacheName = parts[1];
+         }
+      }
+      
+      CacheContainerRegistry registry = DefaultCacheContainerRegistry.getInstance();
+      CacheContainer container = registry.getCacheContainer(containerName);
+      
       String hostName = this.manager.getHostName();
       String host = (hostName == null) || hostName.isEmpty() ? "localhost" : hostName;
       
@@ -106,8 +124,8 @@
       String path = context.isEmpty() || context.equals("/") ? "ROOT" : context.startsWith("/") ? context.substring(1) : context;
 
       String cacheName = host + "/" + path;
-      String templateCacheName = this.manager.getReplicationConfig().getCacheName();
-      EmbeddedCacheManager manager = (EmbeddedCacheManager) this.container.getCache().getCacheManager();
+      
+      EmbeddedCacheManager manager = (EmbeddedCacheManager) container.getCache().getCacheManager();
       manager.defineConfiguration(cacheName, templateCacheName, new Configuration());
       
       this.cache = manager.getCache(cacheName);



More information about the jboss-cvs-commits mailing list