[Jboss-cvs] JBossAS SVN: r56007 - trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 16 16:45:54 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-08-16 16:45:53 -0400 (Wed, 16 Aug 2006)
New Revision: 56007

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteringNotSupportedException.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheManager.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheService.java
Log:
[JBAS-3525] Remove redundant ERROR logging

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteringNotSupportedException.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteringNotSupportedException.java	2006-08-16 20:45:10 UTC (rev 56006)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/ClusteringNotSupportedException.java	2006-08-16 20:45:53 UTC (rev 56007)
@@ -31,8 +31,16 @@
  */
 public class ClusteringNotSupportedException extends Exception
 {
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -2365801349845482947L;
+
    public ClusteringNotSupportedException(String message)
    {
       super(message);
    }
+   
+   public ClusteringNotSupportedException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
 }

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheManager.java	2006-08-16 20:45:10 UTC (rev 56006)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheManager.java	2006-08-16 20:45:53 UTC (rev 56007)
@@ -149,18 +149,11 @@
       this.useJK_ = useJK;
       this.replicationFieldBatchMode_ =
          webMetaData.getReplicationFieldBatchMode() ? Boolean.TRUE : Boolean.FALSE;
-      try
-      {
-         proxy_ = new JBossCacheService(cacheObjectNameString_);
-      }
-      catch (Throwable t)
-      {
-         String str = "JBossCacheService to Tomcat clustering not found";
-         log_.error(str, t);
-         throw new ClusteringNotSupportedException(str);
-      }
+      
+      proxy_ = new JBossCacheService(cacheObjectNameString_);
 
       // Confirm our replication granularity is compatible with the cache
+      // Throws ISE if not
       validateFieldMarshalling();
 
       embedded_ = true;
@@ -1475,6 +1468,7 @@
          proxy_ = new JBossCacheService(cacheObjectNameString_);
          
          // Confirm our replication granularity is compatible with the cache
+         // Throws ISE if not
          validateFieldMarshalling();
          
          // We need to pass the classloader that is associated with this 
@@ -1482,14 +1476,10 @@
          tcl_ = container_.getLoader().getClassLoader();
          proxy_.start(tcl_, this);
       }
-      catch (ClusteringNotSupportedException e)
-      {
-         throw new LifecycleException(e.getMessage(), e);
-      }
       catch (Throwable t)
       {
-         String str = "JBossCacheService to Tomcat clustering not found";
-         log_.error(str);
+         String str = "Problem starting JBossCacheService for Tomcat clustering";
+         log_.error(str, t);
          throw new LifecycleException(str, t);
       }
 
@@ -1732,16 +1722,20 @@
     * If we are using FIELD granularity, checks that the TreeCache
     * supports marshalling.
     * 
-    * @throws ClusteringNotSupportedException if not
+    * @throws IllegalStateException if not
     */
-   private void validateFieldMarshalling() throws ClusteringNotSupportedException
+   private void validateFieldMarshalling()
    {
       if (replicationGranularity_ == WebMetaData.REPLICATION_GRANULARITY_FIELD
             && !proxy_.isMarshallingAvailable())
       {
-            throw new ClusteringNotSupportedException("replication-granularity value is set to " +
-                  "'FIELD' but is not supported by the cache service configuration. " +
-                  "Must set 'UseRegionBasedMarshalling' to 'true' in the tc6-cluster.sar jboss-service.xml");
+         // BES 16/8/2006 -- throw ISE, not ClusteringNotSupportedException, as a
+         // misconfig should be treated differently from the absence of clustering 
+         // services
+         throw new IllegalStateException("replication-granularity value is set to " +
+               "'FIELD' but is not supported by the cache service configuration. " +
+               "Must set 'UseRegionBasedMarshalling' to 'true' in the " +
+               "tc6-cluster.sar jboss-service.xml");
       }
    }
    

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheService.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheService.java	2006-08-16 20:45:10 UTC (rev 56006)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/tc6/session/JBossCacheService.java	2006-08-16 20:45:53 UTC (rev 56007)
@@ -47,7 +47,6 @@
 import org.jboss.aspects.patterns.observable.Subject;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.Fqn;
-import org.jboss.cache.aop.PojoCache;
 import org.jboss.cache.aop.PojoCacheMBean;
 import org.jboss.cache.transaction.BatchModeTransactionManager;
 import org.jboss.invocation.MarshalledValue;
@@ -128,21 +127,28 @@
          // Create Proxy-Object for this service
          proxy_ = (PojoCacheMBean) MBeanProxyExt.create(PojoCacheMBean.class,
                                                         cacheServiceName_);
-         if (proxy_ == null)
-         {
-            throw new RuntimeException("JBossCacheService: locate null TomcatCacheMbean");
-         }
-
-         cacheWrapper_ = new JBossCacheWrapper(proxy_);
-         
-         useTreeCacheMarshalling_ = proxy_.getUseRegionBasedMarshalling();
       }
-      catch (Throwable e)
+      catch (Exception e)
       {
-         String str = cacheServiceName_ + " service to Tomcat clustering not found";
-         log_.error(str);
+         String str = "Could not access TreeCache service " + 
+                      (cacheServiceName_ == null ? "<null>" : cacheServiceName_.toString()) + 
+                      " for Tomcat clustering";
+         log_.debug(str, e);
+         throw new ClusteringNotSupportedException(str, e);
+      }
+      
+      if (proxy_ == null)
+      {
+         String str = "Could not access TreeCache service " + 
+                     (cacheServiceName_ == null ? "<null>" : cacheServiceName_.toString()) + 
+                     " for Tomcat clustering";
+         log_.debug(str);
          throw new ClusteringNotSupportedException(str);
       }
+
+      cacheWrapper_ = new JBossCacheWrapper(proxy_);
+      
+      useTreeCacheMarshalling_ = proxy_.getUseRegionBasedMarshalling();
    }
 
    public void start(ClassLoader tcl, JBossCacheManager manager)




More information about the jboss-cvs-commits mailing list