[jboss-cvs] JBossAS SVN: r98941 - in trunk/cluster/src/main/java/org/jboss/invocation: unified/server and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 28 23:57:20 EST 2009


Author: bstansberry at jboss.com
Date: 2009-12-28 23:57:19 -0500 (Mon, 28 Dec 2009)
New Revision: 98941

Modified:
   trunk/cluster/src/main/java/org/jboss/invocation/http/server/HttpInvokerHA.java
   trunk/cluster/src/main/java/org/jboss/invocation/unified/server/UnifiedInvokerHA.java
Log:
[JBAS-7543] Sync up exception handling between legacy HA invokers

Modified: trunk/cluster/src/main/java/org/jboss/invocation/http/server/HttpInvokerHA.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/invocation/http/server/HttpInvokerHA.java	2009-12-28 16:25:36 UTC (rev 98940)
+++ trunk/cluster/src/main/java/org/jboss/invocation/http/server/HttpInvokerHA.java	2009-12-29 04:57:19 UTC (rev 98941)
@@ -25,8 +25,9 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import javax.management.JMException;
+import javax.management.InstanceNotFoundException;
 import javax.management.ObjectName;
+import javax.management.ReflectionException;
 
 import org.jboss.mx.util.JMXExceptionDecoder;
 import org.jboss.ha.framework.interfaces.HARMIResponse;
@@ -167,18 +168,20 @@
          // Return the raw object and let the http layer marshall it
          return rsp;
       }
-      catch (Exception e)
+      catch (InstanceNotFoundException e)
       {
-         // Unwrap any JMX exceptions
-         e = (Exception) JMXExceptionDecoder.decode(e);
-         // Don't send JMX exception back to client to avoid needing jmx
-         if( e instanceof JMException )
-            e = new GenericClusteringException (GenericClusteringException.COMPLETED_NO, e.getMessage());
+         throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, e);
+      }
+      catch (ReflectionException e)
+      {
+         throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, e);
+      }      
+      catch(Exception e)
+      {
+         JMXExceptionDecoder.rethrow(e);
 
-         // Only log errors if trace is enabled
-         if( log.isTraceEnabled() )
-            log.trace("operation failed", e);
-         throw e;
+         // the compiler does not know an exception is thrown by the above
+         throw new org.jboss.util.UnreachableStatementException();
       }
       finally
       {

Modified: trunk/cluster/src/main/java/org/jboss/invocation/unified/server/UnifiedInvokerHA.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/invocation/unified/server/UnifiedInvokerHA.java	2009-12-28 16:25:36 UTC (rev 98940)
+++ trunk/cluster/src/main/java/org/jboss/invocation/unified/server/UnifiedInvokerHA.java	2009-12-29 04:57:19 UTC (rev 98941)
@@ -25,8 +25,11 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 
+import javax.management.InstanceNotFoundException;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
 import org.jboss.ha.framework.interfaces.GenericClusteringException;
 import org.jboss.ha.framework.interfaces.HARMIResponse;
 import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
@@ -47,7 +50,7 @@
  */
 public class UnifiedInvokerHA extends UnifiedInvoker implements InvokerHA
 {
-   private HashMap beanMap = new HashMap();
+   private HashMap<Integer, HATarget> beanMap = new HashMap<Integer, HATarget>();
 
    public UnifiedInvokerHA()
    {
@@ -157,29 +160,29 @@
 
          if(clientViewId != target.getCurrentViewId())
          {
-            haResponse.newReplicants = new ArrayList(target.getReplicants());
+            haResponse.newReplicants = new ArrayList<Object>(target.getReplicants());
             haResponse.currentViewId = target.getCurrentViewId();
          }
          haResponse.response = obj;
 
          /** End Clustering **/
 
-         return new MarshalledObject(haResponse);
+         return new MarshalledObject<HARMIResponse>(haResponse);
       }
+      catch (InstanceNotFoundException e)
+      {
+         throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, e);
+      }
+      catch (ReflectionException e)
+      {
+         throw new GenericClusteringException(GenericClusteringException.COMPLETED_NO, e);
+      }      
       catch(Exception e)
       {
-         Throwable th = JMXExceptionDecoder.decode(e);
-         if(log.isTraceEnabled())
-         {
-            log.trace("Failed to invoke on mbean: " + mbean, th);
-         }
+         JMXExceptionDecoder.rethrow(e);
 
-         if(th instanceof Exception)
-         {
-            e = (Exception) th;
-         }
-
-         throw e;
+         // the compiler does not know an exception is thrown by the above
+         throw new org.jboss.util.UnreachableStatementException();
       }
       finally
       {




More information about the jboss-cvs-commits mailing list