[jboss-cvs] JBossAS SVN: r107786 - branches/infinispan-int/tomcat/src/main/java/org/jboss/web/tomcat/service/session.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 25 14:06:53 EDT 2010
Author: pferraro
Date: 2010-08-25 14:06:53 -0400 (Wed, 25 Aug 2010)
New Revision: 107786
Modified:
branches/infinispan-int/tomcat/src/main/java/org/jboss/web/tomcat/service/session/JBossCacheManager.java
Log:
Don't perform DCMFactory service loading on every instance.
This allows the default factory to be stateful.
Modified: branches/infinispan-int/tomcat/src/main/java/org/jboss/web/tomcat/service/session/JBossCacheManager.java
===================================================================
--- branches/infinispan-int/tomcat/src/main/java/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2010-08-25 17:52:22 UTC (rev 107785)
+++ branches/infinispan-int/tomcat/src/main/java/org/jboss/web/tomcat/service/session/JBossCacheManager.java 2010-08-25 18:06:53 UTC (rev 107786)
@@ -100,6 +100,16 @@
private static final int TOTAL_PERMITS = Integer.MAX_VALUE;
+ private static final DistributedCacheManagerFactory defaultFactory = findDefaultFactory();
+
+ private static DistributedCacheManagerFactory findDefaultFactory()
+ {
+ for (DistributedCacheManagerFactory factory: ServiceLoader.load(DistributedCacheManagerFactory.class))
+ {
+ return factory;
+ }
+ return null;
+ }
// ------------------------------------------------------------------ Fields
/** The transaction manager. */
@@ -180,23 +190,17 @@
public JBossCacheManager() throws ClusteringNotSupportedException
{
- this(getDistributedCacheManagerFactory());
- }
-
- private static DistributedCacheManagerFactory getDistributedCacheManagerFactory() throws ClusteringNotSupportedException
- {
- for (DistributedCacheManagerFactory factory: ServiceLoader.load(DistributedCacheManagerFactory.class))
+ if (defaultFactory == null)
{
- return factory;
+ throw new ClusteringNotSupportedException("No DistributedCacheManagerFactory service provider found.");
}
- throw new ClusteringNotSupportedException("No DistributedCacheManagerFactory service provider found.");
+
+ this.distributedCacheManagerFactory = defaultFactory;
}
- public JBossCacheManager(DistributedCacheManagerFactory distributedManagerFactory)
+ public JBossCacheManager(DistributedCacheManagerFactory factory) throws ClusteringNotSupportedException
{
- assert distributedManagerFactory != null : "distributedManagerFactory is null";
-
- this.distributedCacheManagerFactory = distributedManagerFactory;
+ this.distributedCacheManagerFactory = factory;
}
// ---------------------------------------------------- AbstractJBossManager
More information about the jboss-cvs-commits
mailing list