[jboss-cvs] JBoss Messaging SVN: r1689 - in branches/Branch_Client_Failover_Experiment/src: etc main/org/jboss/jms/client/container main/org/jboss/jms/client/delegate main/org/jboss/jms/server main/org/jboss/jms/server/connectionfactory main/org/jboss/jms/server/remoting
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Dec 2 10:53:58 EST 2006
Author: timfox
Date: 2006-12-02 10:53:51 -0500 (Sat, 02 Dec 2006)
New Revision: 1689
Modified:
branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java
branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
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/ServerPeer.java
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/remoting/MetaDataConstants.java
Log:
Get basics running again
Modified: branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml 2006-12-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/etc/aop-messaging-client.xml 2006-12-02 15:53:51 UTC (rev 1689)
@@ -18,7 +18,7 @@
<aspect class="org.jboss.jms.client.container.AsfAspect" scope="PER_INSTANCE"/>
<aspect class="org.jboss.jms.client.container.BrowserAspect" scope="PER_INSTANCE"/>
<aspect class="org.jboss.jms.client.container.ConnectionAspect" scope="PER_INSTANCE"/>
- <aspect class="org.jboss.jms.client.container.FailoverAspect" scope="PER_INSTANCE"/>
+ <aspect class="org.jboss.jms.client.container.HAAspect" scope="PER_INSTANCE"/>
<aspect class="org.jboss.jms.client.container.FactoryAspect" scope="PER_INSTANCE"/>
<!-- ConnectionFactory Stack-->
@@ -30,7 +30,7 @@
<advice name="handleCreateConnectionDelegate" aspect="org.jboss.jms.client.container.StateCreationAspect"/>
</bind>
<bind pointcut="execution(* org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate->createConnectionDelegate(..))">
- <advice name="handleCreateConnectionDelegate" aspect="org.jboss.jms.client.container.FailoverAspect"/>
+ <advice name="handleCreateConnectionDelegate" aspect="org.jboss.jms.client.container.HAAspect"/>
</bind>
<!-- Connection Stack -->
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java 2006-12-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/HAAspect.java 2006-12-02 15:53:51 UTC (rev 1689)
@@ -128,17 +128,15 @@
delegates = (ClientConnectionFactoryDelegate[])metaData.getMetaData(MetaDataConstants.JMS, MetaDataConstants.CF_DELEGATES);
- if (delegates == null)
- {
- throw new IllegalStateException("Cannot find delegates!");
+ if (delegates != null)
+ {
+ failoverIndexes = (int[])metaData.getMetaData(MetaDataConstants.JMS, MetaDataConstants.CF_FAILOVER_INDEXES);
+
+ if (failoverIndexes == null)
+ {
+ throw new IllegalStateException("Cannot find failoverIndexes!");
+ }
}
-
- failoverIndexes = (int[])metaData.getMetaData(MetaDataConstants.JMS, MetaDataConstants.CF_FAILOVER_INDEXES);
-
- if (failoverIndexes == null)
- {
- throw new IllegalStateException("Cannot find failoverIndexes!");
- }
}
return delegates;
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2006-12-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/container/StateCreationAspect.java 2006-12-02 15:53:51 UTC (rev 1689)
@@ -91,7 +91,7 @@
((Integer)md.getMetaData(MetaDataConstants.JMS, MetaDataConstants.SERVER_ID)).intValue();
Version connectionVersion =
- (Version)md.getMetaData(MetaDataConstants.JMS, MetaDataConstants.VERSION_NUMBER);
+ (Version)md.getMetaData(MetaDataConstants.JMS, MetaDataConstants.CONNECTION_VERSION);
JMSRemotingConnection connection =
(JMSRemotingConnection)md.getMetaData(MetaDataConstants.JMS, MetaDataConstants.REMOTING_CONNECTION);
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2006-12-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionDelegate.java 2006-12-02 15:53:51 UTC (rev 1689)
@@ -58,7 +58,7 @@
// This should not be exposed other than through meta data
private int serverId;
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
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-12-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java 2006-12-02 15:53:51 UTC (rev 1689)
@@ -27,6 +27,7 @@
import javax.jms.JMSException;
import org.jboss.aop.Advised;
+import org.jboss.aop.Dispatcher;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.aop.metadata.SimpleMetaData;
@@ -156,6 +157,11 @@
if (trace) { log.trace("invoking " + methodName + " on server"); }
SimpleMetaData md = mi.getMetaData();
+
+ md.addMetaData(Dispatcher.DISPATCHER,
+ Dispatcher.OID,
+ new Integer(id),
+ PayloadKey.AS_IS);
/*
* If the method being invoked is createConnectionDelegate then we must invoke it on the same
@@ -212,7 +218,8 @@
}
//What version should we use for invocations on this connection factory?
- byte v = getVersionToUse(serverVersion).getProviderIncrementingVersion();
+ Version version = getVersionToUse(serverVersion);
+ byte v = version.getProviderIncrementingVersion();
MessagingMarshallable request = new MessagingMarshallable(v, mi);
@@ -258,8 +265,8 @@
metaData.addMetaData(MetaDataConstants.JMS, MetaDataConstants.REMOTING_CONNECTION,
remotingConnection, PayloadKey.TRANSIENT);
- metaData.addMetaData(MetaDataConstants.JMS, MetaDataConstants.VERSION_NUMBER,
- new Byte(v), PayloadKey.TRANSIENT);
+ metaData.addMetaData(MetaDataConstants.JMS, MetaDataConstants.CONNECTION_VERSION,
+ version, PayloadKey.TRANSIENT);
}
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java 2006-12-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/ServerPeer.java 2006-12-02 15:53:51 UTC (rev 1689)
@@ -49,7 +49,6 @@
import org.jboss.messaging.core.plugin.contract.PersistenceManager;
import org.jboss.messaging.core.plugin.contract.PostOffice;
import org.jboss.messaging.core.plugin.contract.Replicator;
-import org.jboss.messaging.core.plugin.postoffice.DefaultPostOffice;
import org.jboss.messaging.core.tx.TransactionRepository;
import org.jboss.messaging.util.Util;
import org.jboss.mx.loading.UnifiedClassLoader3;
@@ -128,8 +127,6 @@
protected ObjectName jmsUserManagerObjectName;
protected JMSUserManager jmsUserManager;
- protected Replicator dataReplicator;
-
//Other stuff
// We keep a map of consumers to prevent us to recurse through the attached session in order to
@@ -602,6 +599,15 @@
{
queuePostOffice = (PostOffice)getServer().
getAttribute(queuePostOfficeObjectName, "Instance");
+
+ //We also inject the replicator dependency into the ConnectionFactoryJNDIMapper
+ //This is a bit messy but we have a circular dependency
+ //POJOContainer should be able to help us here
+
+ if (!queuePostOffice.isLocal())
+ {
+ connFactoryJNDIMapper.injectReplicator((Replicator)queuePostOffice);
+ }
}
return queuePostOffice;
}
@@ -617,21 +623,6 @@
return topicPostOffice;
}
- public Replicator getDataReplicator() throws Exception
- {
- // For now we just choose the queue post office - soon we merge both post offices into one
- // anyway
-
- PostOffice office = getQueuePostOfficeInstance();
-
- if (!office.isLocal())
- {
- dataReplicator = (Replicator)office;
- }
-
- return dataReplicator;
- }
-
public synchronized int getNextObjectID()
{
return objectIDSequence++;
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-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java 2006-12-02 15:53:51 UTC (rev 1689)
@@ -104,31 +104,36 @@
ClientConnectionFactoryDelegate delegate =
new ClientConnectionFactoryDelegate(id, locatorURI, serverPeer.getVersion(), clientPing);
-
+
if (clustered)
{
- // 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
-
- setUpReplicator();
-
- replicator.putReplicant(CF_PREFIX + uniqueName, delegate);
+ setupReplicator();
- // Get the list of delegates
-
- Map replicants = replicator.getReplicants(CF_PREFIX + uniqueName);
-
- //Create a clustered delegate which contains the array of the local delegates
- //and failover indexes
-
- ClusteredClientConnectionFactoryDelegate clusteredDel =
- new ClusteredClientConnectionFactoryDelegate(id,
- locatorURI, serverPeer.getVersion(), clientPing);
-
- setFailoverDelegates(clusteredDel, replicants);
-
- delegate = clusteredDel;
+ //We may have no clustered post office deployed, in which case a clustered connection factory
+ //behaves like a standard connection factory
+ if (replicator != null)
+ {
+ // 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
+
+ replicator.putReplicant(CF_PREFIX + uniqueName, delegate);
+
+ // Get the list of delegates
+
+ Map replicants = replicator.getReplicants(CF_PREFIX + uniqueName);
+
+ //Create a clustered delegate which contains the array of the local delegates
+ //and failover indexes
+
+ ClusteredClientConnectionFactoryDelegate clusteredDel =
+ new ClusteredClientConnectionFactoryDelegate(id,
+ locatorURI, serverPeer.getVersion(), clientPing);
+
+ setFailoverDelegates(clusteredDel, replicants);
+
+ delegate = clusteredDel;
+ }
}
ConnectionFactoryAdvised connFactoryAdvised = new ConnectionFactoryAdvised(endpoint);
@@ -185,11 +190,16 @@
if (clustered)
{
+ setupReplicator();
+
// Remove from replicants
- setUpReplicator();
-
- replicator.removeReplicant(CF_PREFIX + uniqueName);
+ if (replicator != null)
+ {
+ //There may be no clustered post office deployed
+ replicator.removeReplicant(CF_PREFIX + uniqueName);
+ }
+
}
JMSDispatcher.instance.unregisterTarget(new Integer(endpoint.getID()));
@@ -289,13 +299,25 @@
// Public --------------------------------------------------------
+ public void injectReplicator(Replicator replicator)
+ {
+ this.replicator = replicator;
+
+ replicator.registerListener(this);
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
+ private void setupReplicator() throws Exception
+ {
+ this.serverPeer.getQueuePostOfficeInstance();
+ }
+
private void setFailoverDelegates(ClusteredClientConnectionFactoryDelegate cf,
Map replicants)
{
@@ -365,20 +387,5 @@
cf.setFailoverDelegates(delegates, failoverIndexes);
}
- private void setUpReplicator() throws Exception
- {
- if (replicator == null)
- {
- replicator = serverPeer.getDataReplicator();
-
- if (replicator == null)
- {
- throw new IllegalStateException("Cannot get replicator from ServerPeer!");
- }
-
- replicator.registerListener(this);
- }
- }
-
// Inner classes -------------------------------------------------
}
Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MetaDataConstants.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MetaDataConstants.java 2006-12-02 15:51:53 UTC (rev 1688)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/remoting/MetaDataConstants.java 2006-12-02 15:53:51 UTC (rev 1689)
@@ -54,4 +54,6 @@
public static final String REMOTING_CONNECTION = "REMOTING_CONNECTION";
public static final String CF_FAILOVER_INDEXES = "CF_FAIL_IND";
+
+ public static final String CONNECTION_VERSION = "CONNECTION_VERSION";
}
More information about the jboss-cvs-commits
mailing list