[jboss-cvs] JBossAS SVN: r76261 - trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jul 27 14:07:30 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-07-27 14:07:30 -0400 (Sun, 27 Jul 2008)
New Revision: 76261

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java
Log:
[JBAS-5659] Add method for sending multiple requests; rationalize method names

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java	2008-07-27 18:06:56 UTC (rev 76260)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/modcluster/ha/ClusteredMCMPHandlerImpl.java	2008-07-27 18:07:30 UTC (rev 76261)
@@ -58,6 +58,7 @@
    private static final Object[] NULL_ARGS = new Object[0];
    private static final Class[] NULL_TYPES = new Class[0];
    private static final Class[] MCMPREQ_TYPES = new Class[] { MCMPRequest.class };
+   private static final Class[] MCMPREQS_TYPES = new Class[] { List.class };
    private static final Class[] DISC_EVENT_TYPES = new Class[] { MCMPServerDiscoveryEvent.class, int.class };
    
    private static final Logger log = Logger.getLogger(ClusteredMCMPHandlerImpl.class);
@@ -145,7 +146,7 @@
    {
       for (MCMPServer server : masterList)
       {         
-         this.localHandler.addProxy(server.getAddress(), server.getPort());         
+         this.localHandler.addProxy(server.getAddress(), server.getPort(), server.isEstablished());         
       }
       
       for (MCMPServer server : this.localHandler.getProxyStates())
@@ -228,9 +229,9 @@
       }      
    }
 
-   public void establishProxy(MCMPServer server)
+   public void addProxy(InetAddress address, int port, boolean established)
    {
-      throw new UnsupportedOperationException("Should not be invoked on ClusteredMCMPHandler");       
+      this.localHandler.addProxy(address, port, established);               
    }
    
    
@@ -385,6 +386,35 @@
       }
    }
 
+   @SuppressWarnings("unchecked")
+   public void sendRequests(List<MCMPRequest> requests)
+   {
+      if (isMasterNode())
+      {
+         this.localHandler.sendRequests(requests);
+      }
+      else
+      {
+         GroupRpcResponse response = null;
+         try
+         {
+            List<Object> rsps = this.partition.callMethodOnCluster(this.haServiceName, "sendRequests", new Object[] { requests }, MCMPREQS_TYPES, false, new GroupRpcResponseFilter());
+            response = extractGroupRpcResponse(rsps, "sendRequests");
+         }
+         catch (Exception e)
+         {
+            recordRequestFailure();
+            throw Utils.convertToUnchecked(e);
+         }
+         
+         if (response instanceof ThrowableGroupRpcResponse)
+         {
+            recordRequestFailure();
+            throw ((ThrowableGroupRpcResponse) response).getValueAsRuntimeException();
+         }
+      }
+   }
+
    public void shutdown()
    {
       stopListener();




More information about the jboss-cvs-commits mailing list