[jboss-cvs] JBoss Messaging SVN: r1647 - in branches/Branch_Client_Failover_Experiment/src/main/org/jboss: jms/server/connectionfactory jms/server/ha messaging/core/plugin/postoffice/cluster messaging/core/plugin/postoffice/cluster/factoryinterface

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 28 01:28:52 EST 2006


Author: clebert.suconic at jboss.com
Date: 2006-11-28 01:28:47 -0500 (Tue, 28 Nov 2006)
New Revision: 1647

Added:
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryInfo.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryUpdater.java
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/ha/ClusteredConnectionFactory.java
Log:
Using MBean name instead of clientID

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-28 05:19:09 UTC (rev 1646)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-11-28 06:28:47 UTC (rev 1647)
@@ -42,6 +42,8 @@
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
 import org.jboss.messaging.core.plugin.postoffice.cluster.NodeAddressInfo;
+import org.jboss.messaging.core.plugin.postoffice.cluster.factoryinterface.ConnectionFactoryInfo;
+import org.jboss.messaging.core.plugin.postoffice.cluster.factoryinterface.ConnectionFactoryUpdater;
 
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
@@ -51,7 +53,7 @@
  *
  * $Id$
  */
-public class ConnectionFactoryJNDIMapper implements ConnectionFactoryManager
+public class ConnectionFactoryJNDIMapper implements ConnectionFactoryManager, ConnectionFactoryUpdater
 {
    // Constants -----------------------------------------------------
 
@@ -161,6 +163,23 @@
       return id;
    }
 
+
+   public ConnectionFactoryInfo[] getDatasourceInformation()
+   {
+      ConnectionFactoryInfo[] info = new ConnectionFactoryInfo[factories.size()];
+      int counter = 0;
+      for (Iterator iter = factories.entrySet().iterator(); iter.hasNext();)
+      {
+         Map.Entry entry = (Map.Entry) iter.next();
+         String name = (String) entry.getKey();
+         JBossConnectionFactory factory = (JBossConnectionFactory) entry.getValue();
+         ClientConnectionFactoryDelegate delegate = (ClientConnectionFactoryDelegate)factory.getDelegate();
+         String locatorURL = delegate.getServerLocatorURI();
+         info [counter++] = new ConnectionFactoryInfo(name, locatorURL);
+      }
+      return info;
+   }
+
    public synchronized void unregisterConnectionFactory(String serverObjectID) throws Exception
    {
       ServerConnectionFactoryEndpoint endpoint =

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ha/ClusteredConnectionFactory.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ha/ClusteredConnectionFactory.java	2006-11-28 05:19:09 UTC (rev 1646)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ha/ClusteredConnectionFactory.java	2006-11-28 06:28:47 UTC (rev 1647)
@@ -27,6 +27,7 @@
 import org.jboss.jms.server.connectionfactory.JNDIBindings;
 import org.jboss.jms.util.ExceptionUtil;
 import org.jboss.messaging.core.plugin.contract.ClusteredPostOffice;
+import org.jboss.messaging.core.plugin.postoffice.cluster.factoryinterface.ConnectionFactoryUpdater;
 import org.jboss.system.ServiceMBeanSupport;
 import org.w3c.dom.Element;
 
@@ -129,10 +130,17 @@
 
          ClusteredPostOffice postOffice = (ClusteredPostOffice) server.getAttribute(clusteredPostOffice, "Instance");
 
-         serverPeer.getConnectionFactoryManager().registerClusteredConnectionFactory(postOffice, this.jndiBindings);
+         //serverPeer.getConnectionFactoryManager().registerClusteredConnectionFactory(postOffice, this.jndiBindings);
 
-         postOffice.setClusteredConnectionInformation(serverPeer.getConnectionFactoryManager(), this.jndiBindings);
+         ConnectionFactoryUpdater updater = (ConnectionFactoryUpdater)serverPeer.getConnectionFactoryManager();
 
+         //TODO Set the updater into PostOffice
+
+         System.out.println("*************** number of factories - " + updater.getDatasourceInformation().length);
+
+
+         //postOffice.setClusteredConnectionInformation(serverPeer.getConnectionFactoryManager(), this.jndiBindings);
+
          started = true;
       }
       catch (Throwable t)

Added: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryInfo.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryInfo.java	2006-11-28 05:19:09 UTC (rev 1646)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryInfo.java	2006-11-28 06:28:47 UTC (rev 1647)
@@ -0,0 +1,81 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+
+package org.jboss.messaging.core.plugin.postoffice.cluster.factoryinterface;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import org.jboss.messaging.util.Streamable;
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision:$</tt>
+ *          <p/>
+ *          $Id:$
+ */
+public class ConnectionFactoryInfo implements Streamable
+{
+   public ConnectionFactoryInfo()
+   {
+   }
+
+   public ConnectionFactoryInfo(String factoryName, String serverLocatorURI)
+   {
+      this.serverLocatorURI = serverLocatorURI;
+      this.factoryName = factoryName;
+   }
+
+   private String serverLocatorURI;
+   private String factoryName;
+
+   public String getServerLocatorURI()
+   {
+      return serverLocatorURI;
+   }
+
+   public void setServerLocatorURI(String serverLocatorURI)
+   {
+      this.serverLocatorURI = serverLocatorURI;
+   }
+
+   public String getFactoryName()
+   {
+      return factoryName;
+   }
+
+   public void setFactoryName(String factoryName)
+   {
+      this.factoryName = factoryName;
+   }
+
+   public void write(DataOutputStream out) throws Exception
+   {
+      out.writeUTF(serverLocatorURI);
+      out.writeUTF(factoryName);
+   }
+
+   public void read(DataInputStream in) throws Exception
+   {
+      serverLocatorURI = in.readUTF();
+      factoryName = in.readUTF();
+   }
+}

Added: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryUpdater.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryUpdater.java	2006-11-28 05:19:09 UTC (rev 1646)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/factoryinterface/ConnectionFactoryUpdater.java	2006-11-28 06:28:47 UTC (rev 1647)
@@ -0,0 +1,34 @@
+/*
+   * JBoss, Home of Professional Open Source
+   * Copyright 2005, JBoss Inc., and individual contributors as indicated
+   * by the @authors tag. See the copyright.txt in the distribution for a
+   * full listing of individual contributors.
+   *
+   * This is free software; you can redistribute it and/or modify it
+   * under the terms of the GNU Lesser General Public License as
+   * published by the Free Software Foundation; either version 2.1 of
+   * the License, or (at your option) any later version.
+   *
+   * This software is distributed in the hope that it will be useful,
+   * but WITHOUT ANY WARRANTY; without even the implied warranty of
+   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   * Lesser General Public License for more details.
+   *
+   * You should have received a copy of the GNU Lesser General Public
+   * License along with this software; if not, write to the Free
+   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+   */
+
+package org.jboss.messaging.core.plugin.postoffice.cluster.factoryinterface;
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision:$</tt>
+ *          <p/>
+ *          $Id:$
+ */
+public interface ConnectionFactoryUpdater
+{
+   public ConnectionFactoryInfo[] getDatasourceInformation();
+}




More information about the jboss-cvs-commits mailing list