[jboss-cvs] JBossAS SVN: r61698 - in trunk/cluster/src/main/org/jboss/ha/framework: server and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 26 10:50:19 EDT 2007


Author: jerrygauth
Date: 2007-03-26 10:50:18 -0400 (Mon, 26 Mar 2007)
New Revision: 61698

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/interfaces/HAPartition.java
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
Log:
JBAS-4106, API change checkin

Modified: trunk/cluster/src/main/org/jboss/ha/framework/interfaces/HAPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/interfaces/HAPartition.java	2007-03-26 14:26:42 UTC (rev 61697)
+++ trunk/cluster/src/main/org/jboss/ha/framework/interfaces/HAPartition.java	2007-03-26 14:50:18 UTC (rev 61698)
@@ -93,7 +93,22 @@
     * @param handler object to be called when receiving a RPC for its key.
     */   
    public void registerRPCHandler(String serviceName, Object handler);
+   
    /**
+    * The partition receives RPC calls from other nodes in the cluster and demultiplexes
+    * them, according to a service name, to a particular service. Consequently, each
+    * service must first subscribe with a particular service name in the partition. The subscriber
+    * does not need to implement any specific interface: the call is handled
+    * dynamically through reflection.
+    * In cases where the client is using a scoped classloader, the client will need to provide a 
+    * reference to the classloader if the service's RPC calls use custom parameter or response object types. 
+    * @param serviceName Name of the subscribing service (demultiplexing key)
+    * @param handler object to be called when receiving a RPC for its key.
+    * @param classloader ClassLoader to be used when marshalling and unmarshalling RPC requests and responses.
+    */   
+   public void registerRPCHandler(String serviceName, Object handler, ClassLoader classloader);
+   
+   /**
     * Unregister the service from the partition
     * @param serviceName Name of the service key (on which the demultiplexing occurs)
     * @param subscriber The target object that unsubscribes
@@ -117,7 +132,6 @@
    public ArrayList callMethodOnCluster(String serviceName, String methodName,
          Object[] args, Class[] types, boolean excludeSelf) throws Exception;
 
-
    /**
     *
     * @param serviceName Name of the target service name on which calls are de-multiplexed

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-03-26 14:26:42 UTC (rev 61697)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-03-26 14:50:18 UTC (rev 61698)
@@ -27,6 +27,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Serializable;
+import java.lang.ref.WeakReference;
 import java.net.InetAddress;
 import java.rmi.dgc.VMID;
 import java.rmi.server.UID;
@@ -37,6 +38,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -110,6 +112,29 @@
       /** The serialVersionUID */
       private static final long serialVersionUID = -3705345735451504946L;      
    }
+   
+   private static class HAServiceResponse implements Serializable
+   {
+      private static final long serialVersionUID = -6485594652749906437L;
+      private final String serviceName;
+      private final byte[] payload;
+           
+      public HAServiceResponse(String serviceName, byte[] payload)
+      {
+         this.serviceName = serviceName;
+         this.payload = payload;
+      }
+           
+      public String getServiceName()
+      {
+         return serviceName;
+      }
+           
+      public byte[] getPayload()
+      {
+         return payload;
+      }
+   }
 
    // Constants -----------------------------------------------------
 
@@ -118,7 +143,7 @@
    // Attributes ----------------------------------------------------
 
    protected ClusterPartitionConfig config;
-   protected HashMap rpcHandlers = new HashMap();
+   protected HashMap<String, Object> rpcHandlers = new HashMap<String, Object>();
    protected HashMap stateHandlers = new HashMap();
    /** Do we send any membership change notifications synchronously? */
    protected boolean allowSyncListeners = false;
@@ -131,6 +156,8 @@
    /** The current cluster partition members */
    protected Vector members = null;
    protected Vector jgmembers = null;
+   protected ConcurrentHashMap<String, WeakReference<ClassLoader>> clmap =
+                                          new ConcurrentHashMap<String, WeakReference<ClassLoader>>();
 
    public Vector history = null;
 
@@ -850,11 +877,17 @@
       rpcHandlers.put(objName, subscriber);
    }
    
+   public void registerRPCHandler(String objName, Object subscriber, ClassLoader classloader)
+   {
+      registerRPCHandler(objName, subscriber);
+      clmap.put(objName, new WeakReference<ClassLoader>(classloader));
+   }
+   
    public void unregisterRPCHandler(String objName, Object subscriber)
    {
       rpcHandlers.remove(objName);
-   }
-      
+      clmap.remove(objName);
+   }      
 
    /**
     *




More information about the jboss-cvs-commits mailing list