[jboss-cvs] JBossAS SVN: r107219 - in projects/cluster/ha-server-cache-ispn/trunk/src: test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 29 19:47:30 EDT 2010


Author: pferraro
Date: 2010-07-29 19:47:30 -0400 (Thu, 29 Jul 2010)
New Revision: 107219

Modified:
   projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
   projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java
Log:
Parameterize via setters instead of constructor

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java	2010-07-29 20:53:29 UTC (rev 107218)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/main/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java	2010-07-29 23:47:30 UTC (rev 107219)
@@ -35,28 +35,31 @@
  */
 public class DistributedCacheManagerFactoryImpl implements DistributedCacheManagerFactory
 {
-   private final SessionAttributeStorageFactory storageFactory;
-   private final SessionAttributeMarshallerFactory marshallerFactory;
-   private final CacheInvoker invoker;
+   private SessionAttributeStorageFactory storageFactory = new SessionAttributeStorageFactoryImpl();
+   private SessionAttributeMarshallerFactory marshallerFactory = new SessionAttributeMarshallerFactoryImpl();
+   private CacheInvoker invoker = new RetryingCacheInvoker(10, 100);
    
-   public DistributedCacheManagerFactoryImpl()
+   @Override
+   public <T extends OutgoingDistributableSessionData> DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager)
    {
-      this(new SessionAttributeStorageFactoryImpl(), new SessionAttributeMarshallerFactoryImpl(), new RetryingCacheInvoker(10, 100));
+      SessionAttributeMarshaller marshaller = this.marshallerFactory.createMarshaller(manager);
+      SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), marshaller);
+      
+      return new DistributedCacheManagerImpl<T>(manager, DefaultCacheContainerRegistry.getInstance(), storage, this.invoker);
    }
    
-   public DistributedCacheManagerFactoryImpl(SessionAttributeStorageFactory storageFactory, SessionAttributeMarshallerFactory marshallerFactory, CacheInvoker invoker)
+   public void setSessionAttributeStorageFactory(SessionAttributeStorageFactory storageFactory)
    {
       this.storageFactory = storageFactory;
+   }
+   
+   public void setSessionAttributeMarshallerFactory(SessionAttributeMarshallerFactory marshallerFactory)
+   {
       this.marshallerFactory = marshallerFactory;
-      this.invoker = invoker;
    }
    
-   @Override
-   public <T extends OutgoingDistributableSessionData> DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager)
+   public void setCacheInvoker(CacheInvoker invoker)
    {
-      SessionAttributeMarshaller marshaller = this.marshallerFactory.createMarshaller(manager);
-      SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), marshaller);
-      
-      return new DistributedCacheManagerImpl<T>(manager, DefaultCacheContainerRegistry.getInstance(), storage, this.invoker);
+      this.invoker = invoker;
    }
 }

Modified: projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java
===================================================================
--- projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java	2010-07-29 20:53:29 UTC (rev 107218)
+++ projects/cluster/ha-server-cache-ispn/trunk/src/test/java/org/jboss/ha/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryTest.java	2010-07-29 23:47:30 UTC (rev 107219)
@@ -38,7 +38,6 @@
 import org.jboss.metadata.web.jboss.ReplicationConfig;
 import org.jboss.metadata.web.jboss.ReplicationGranularity;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager;
-import org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManagerFactory;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager;
 import org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData;
 import org.junit.Assert;
@@ -96,7 +95,10 @@
       
       try
       {
-         DistributedCacheManagerFactory factory = new DistributedCacheManagerFactoryImpl(this.storageFactory, this.marshallerFactory, this.invoker);
+         DistributedCacheManagerFactoryImpl factory = new DistributedCacheManagerFactoryImpl();
+         factory.setSessionAttributeStorageFactory(this.storageFactory);
+         factory.setSessionAttributeMarshallerFactory(this.marshallerFactory);
+         factory.setCacheInvoker(this.invoker);
          
          ReplicationConfig config = new ReplicationConfig();
          ReplicationGranularity granularity = ReplicationGranularity.SESSION;



More information about the jboss-cvs-commits mailing list