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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 1 19:04:55 EST 2006


Author: clebert.suconic at jboss.com
Date: 2006-12-01 19:04:52 -0500 (Fri, 01 Dec 2006)
New Revision: 1676

Modified:
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml
   branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/connection-factories-service.xml
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
Log:
changing dependencies as explained in
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990684#3990684

Modified: branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml	2006-12-01 23:08:04 UTC (rev 1675)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/clustered-mysql-persistence-service.xml	2006-12-02 00:04:52 UTC (rev 1676)
@@ -62,7 +62,6 @@
       xmbean-dd="xmdesc/ClusteredPostOffice-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
-      <depends>jboss.messaging.destination:service=ConnectionFactory</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
       <attribute name="PostOfficeName">Clustered Queue</attribute>
       <attribute name="DataSource">java:/DefaultDS</attribute>
@@ -127,7 +126,6 @@
       xmbean-dd="xmdesc/ClusteredPostOffice-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
-      <depends>jboss.messaging.destination:service=ConnectionFactory</depends>
       <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>
       <attribute name="PostOfficeName">Clustered Topic</attribute>
       <attribute name="DataSource">java:/DefaultDS</attribute>

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-12-01 23:08:04 UTC (rev 1675)
+++ branches/Branch_Client_Failover_Experiment/src/etc/server/default/deploy/connection-factories-service.xml	2006-12-02 00:04:52 UTC (rev 1676)
@@ -13,6 +13,7 @@
       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>
+      <depends>jboss.messaging:service=QueuePostOffice</depends>
 
       <attribute name="JNDIBindings">
          <bindings>

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-12-01 23:08:04 UTC (rev 1675)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-12-02 00:04:52 UTC (rev 1676)
@@ -26,11 +26,9 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-
 import org.jboss.jms.client.JBossConnectionFactory;
 import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
 import org.jboss.jms.client.delegate.ClusteredClientConnectionFactoryDelegate;
@@ -52,7 +50,7 @@
  *
  * $Id$
  */
-public class ConnectionFactoryJNDIMapper 
+public class ConnectionFactoryJNDIMapper
    implements ConnectionFactoryManager, ReplicationListener
 {
    // Constants -----------------------------------------------------
@@ -82,9 +80,9 @@
    }
    
    // ConnectionFactoryManager implementation -----------------------
-   
-   
-   
+
+
+
    public synchronized void registerConnectionFactory(String uniqueName,
             String clientID,
             JNDIBindings jndiBindings,
@@ -113,9 +111,10 @@
          //First we must replicate the delegate across the cluster so that all the ConnectionFactoryJNDIMapper
          //instances on different nodes have access to the list of local connection factories
          //so they can be added to the clustered connection factory
+
+         getReplicator();
+         replicator.putReplicant(CF_PREFIX + uniqueName, delegate);
          
-         replicator.putReplicant(CF_PREFIX + uniqueName, delegate);         
-         
          //Get the list of delegates
          
          Map replicants = replicator.getReplicants(CF_PREFIX + uniqueName);
@@ -187,8 +186,9 @@
       if (clustered)
       {
          //Remove from replicants
-         
-         replicator.removeReplicant(CF_PREFIX + uniqueName);         
+
+         getReplicator();
+         replicator.removeReplicant(CF_PREFIX + uniqueName);
       }
       
       JMSDispatcher.instance.unregisterTarget(new Integer(endpoint.getID()));
@@ -200,13 +200,19 @@
    {
       initialContext = new InitialContext();
       
+      /*
+
+      ConnectionFActoryJNDIMapper is started in a call of ServerPeer, while replicator is started later
+      when the postoffices are started. So, I'm keeping the registration of replicator lazy on the first connection
+      Allthough this is not a proper design, as we might loose messages when the PostOffice is connected
+
       replicator = serverPeer.getDataReplicator();
-      
+
       if (replicator != null)
       {
          replicator.registerListener(this);
-      }
-      
+      } */
+
       log.debug("started");
    }
    
@@ -317,7 +323,7 @@
          ClientConnectionFactoryDelegate del = (ClientConnectionFactoryDelegate)entry.getValue();
          
          delegates[i] = del;
-         
+
          int failoverNode = replicator.getFailoverNodeForNode(nodeId);
          
          nodes[i] = nodeId;
@@ -360,6 +366,21 @@
       
       cf.setFailoverDelegates(delegates, failoverIndexes);
    }
+
+   private Replicator getReplicator() throws Exception
+   {
+      if (replicator==null)
+      {
+         replicator = serverPeer.getDataReplicator();
+
+         if (replicator != null)
+         {
+            replicator.registerListener(this);
+         }
+      }
+      return replicator;
+   }
+
    
    // Inner classes -------------------------------------------------
 }




More information about the jboss-cvs-commits mailing list