[jboss-cvs] JBoss Messaging SVN: r1645 - in branches/Branch_Client_Failover_Experiment/src: etc/server/default/deploy main/org/jboss/jms/client/delegate main/org/jboss/jms/server main/org/jboss/jms/server/connectionfactory

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 27 21:21:57 EST 2006


Author: clebert.suconic at jboss.com
Date: 2006-11-27 21:21:52 -0500 (Mon, 27 Nov 2006)
New Revision: 1645

Modified:
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/connection-factories-service.xml
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
Log:
Using clientID instead of ObjectID on ConnectionFactories

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/connection-factories-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/connection-factories-service.xml	2006-11-27 19:31:37 UTC (rev 1644)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/connection-factories-service.xml	2006-11-28 02:21:52 UTC (rev 1645)
@@ -13,6 +13,12 @@
       xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=socket</depends>
+
+      <constructor>
+         <!-- ClientId for the ConnectionFactory -->
+         <arg type="java.lang.String" value="SocketFactory"/>
+      </constructor>
+
       <attribute name="JNDIBindings">
          <bindings>
             <binding>/ConnectionFactory</binding>

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-11-27 19:31:37 UTC (rev 1644)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2006-11-28 02:21:52 UTC (rev 1645)
@@ -23,9 +23,7 @@
 
 import java.util.HashMap;
 import java.util.Map;
-
 import javax.jms.JMSException;
-
 import org.jboss.aop.Dispatcher;
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
@@ -70,6 +68,7 @@
    protected Version serverVersion;
    protected int serverID;
    protected boolean clientPing;
+   protected String clientID;
 
    private boolean trace;
 
@@ -77,12 +76,13 @@
 
    // Constructors --------------------------------------------------
 
-   public ClientConnectionFactoryDelegate(int objectID, String serverLocatorURI,
+   public ClientConnectionFactoryDelegate(int objectID, String clientID, String serverLocatorURI,
                                           Version serverVersion, int serverID,
                                           boolean clientPing)
    {
       super(objectID);
 
+      this.clientID = clientID;
       this.serverLocatorURI = serverLocatorURI;
       this.serverVersion = serverVersion;
       this.serverID = serverID;
@@ -137,9 +137,11 @@
 
       md.addMetaData(Dispatcher.DISPATCHER,
                      Dispatcher.OID,
-                     new Integer(id),
+                     clientID,
                      PayloadKey.AS_IS);
-      
+
+      md.addMetaData("JMSConnectionFactory", "ClientID", this.clientID, PayloadKey.AS_IS);
+
       /*
        * If the method being invoked is createConnectionDelegate then we must invoke it on the same
        * remoting client subsequently used by the connection.
@@ -255,6 +257,11 @@
       return serverID;
    }
 
+   public String getClientID()
+   {
+      return clientID;
+   }
+
    public Version getVersionToUse()
    {
       Version clientVersion = Version.instance();
@@ -280,7 +287,7 @@
 
    public String toString()
    {
-      return "ConnectionFactoryDelegate[" + id + "]";
+      return "ConnectionFactoryDelegate[clientID" + clientID + "]";
    }
 
    // Protected -----------------------------------------------------

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2006-11-27 19:31:37 UTC (rev 1644)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2006-11-28 02:21:52 UTC (rev 1645)
@@ -49,7 +49,7 @@
    void registerClusteredConnectionFactory(ClusteredPostOffice postOffice,
                                                                JNDIBindings jndiBindings) throws Exception;
 
-   void unregisterConnectionFactory(int connectionFactoryID) throws Exception;
+   void unregisterConnectionFactory(String connectionFactoryID) throws Exception;
 
    javax.jms.ConnectionFactory getConnectionFactory(int connectionFactoryID);
 

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2006-11-27 19:31:37 UTC (rev 1644)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2006-11-28 02:21:52 UTC (rev 1645)
@@ -7,7 +7,6 @@
 package org.jboss.jms.server.connectionfactory;
 
 import javax.management.ObjectName;
-
 import org.jboss.jms.server.ConnectionFactoryManager;
 import org.jboss.jms.server.ConnectionManager;
 import org.jboss.jms.server.ConnectorManager;
@@ -55,10 +54,12 @@
 
    // Constructors --------------------------------------------------
 
+   /**
+    * Since 1.2 ConnectionFactories need a clientID
    public ConnectionFactory()
    {
       this(null);
-   }
+   } */
 
    public ConnectionFactory(String clientID)
    {
@@ -139,7 +140,7 @@
       {
          started = false;
          
-         connectionFactoryManager.unregisterConnectionFactory(connectionFactoryID);
+         connectionFactoryManager.unregisterConnectionFactory(clientID);
          
          connectorManager.unregisterConnector(connectorObjectName.getCanonicalName());
          

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-11-27 19:31:37 UTC (rev 1644)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-11-28 02:21:52 UTC (rev 1645)
@@ -21,7 +21,11 @@
   */
 package org.jboss.jms.server.connectionfactory;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
@@ -42,6 +46,7 @@
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
  * @version <tt>$Revision$</tt>
  *
  * $Id$
@@ -122,20 +127,20 @@
       int id = serverPeer.getNextObjectID();
 
       ServerConnectionFactoryEndpoint endpoint =
-         new ServerConnectionFactoryEndpoint(id, serverPeer, clientID, jndiBindings,
+         new ServerConnectionFactoryEndpoint(-1, serverPeer, clientID, jndiBindings,
                                              prefetchSize, defaultTempQueueFullSize,
                                              defaultTempQueuePageSize,
                                              defaultTempQueueDownCacheSize);
 
       ClientConnectionFactoryDelegate delegate =
-         new ClientConnectionFactoryDelegate(id, locatorURI, serverPeer.getVersion(),
+         new ClientConnectionFactoryDelegate(-1, clientID, locatorURI, serverPeer.getVersion(),
                                              serverPeer.getServerPeerID(), clientPing);
 
       ConnectionFactoryAdvised connFactoryAdvised = new ConnectionFactoryAdvised(endpoint);
 
-      JMSDispatcher.instance.registerTarget(new Integer(id), connFactoryAdvised);
+      JMSDispatcher.instance.registerTarget(clientID, connFactoryAdvised);
 
-      endpoints.put(new Integer(id), endpoint);
+      endpoints.put(clientID, endpoint);
 
       JBossConnectionFactory cf = new JBossConnectionFactory(delegate);
 
@@ -149,15 +154,15 @@
          }
       }
 
-      factories.put(new Integer(id), cf);
+      factories.put(clientID, cf);
 
       return id;
    }
 
-   public synchronized void unregisterConnectionFactory(int connFactoryID) throws Exception
+   public synchronized void unregisterConnectionFactory(String clientID) throws Exception
    {
       ServerConnectionFactoryEndpoint endpoint =
-         (ServerConnectionFactoryEndpoint)endpoints.get(new Integer(connFactoryID));
+         (ServerConnectionFactoryEndpoint)endpoints.get(clientID);
 
       JNDIBindings jndiBindings = endpoint.getJNDIBindings();
       if (jndiBindings != null)
@@ -170,7 +175,11 @@
             log.debug(jndiName + " unregistered");
          }
       }
-      JMSDispatcher.instance.unregisterTarget(new Integer(connFactoryID));
+
+      JMSDispatcher.instance.unregisterTarget(clientID);
+
+      endpoints.remove(clientID);
+      factories.remove(clientID);
    }
 
    public synchronized javax.jms.ConnectionFactory getConnectionFactory(int connectionFactoryID)




More information about the jboss-cvs-commits mailing list