activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r374729 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms: DestinationBridge.java JmsConnector.java JmsQueueConnector.java JmsTopicConnector.java
Date Fri, 03 Feb 2006 19:22:46 GMT
Author: rajdavies
Date: Fri Feb  3 11:22:40 2006
New Revision: 374729

URL: http://svn.apache.org/viewcvs?rev=374729&view=rev
Log:
separate JndiTemplate into local and outbound

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java?rev=374729&r1=374728&r2=374729&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
Fri Feb  3 11:22:40 2006
@@ -24,6 +24,7 @@
 import javax.jms.MessageProducer;
 
 import org.apache.activemq.Service;
+import org.apache.activemq.command.ActiveMQMessage;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
@@ -94,6 +95,9 @@
                     message.setJMSReplyTo(null);
                 }
                 Message converted=jmsMessageConvertor.convert(message);
+                if (converted == message && converted instanceof ActiveMQMessage){
+                    converted = (Message) ((ActiveMQMessage)converted).copy();
+                }
                 sendMessage(converted);
                 message.acknowledge();
             }catch(JMSException e){

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java?rev=374729&r1=374728&r2=374729&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
Fri Feb  3 11:22:40 2006
@@ -38,7 +38,8 @@
  */
 public abstract class JmsConnector implements Service{
     private static final Log log=LogFactory.getLog(JmsConnector.class);
-    protected JndiTemplate jndiTemplate;
+    protected JndiTemplate jndiLocalTemplate;
+    protected JndiTemplate jndiOutboundTemplate;
     protected JmsMesageConvertor jmsMessageConvertor;
     private List inboundBridges = new CopyOnWriteArrayList();
     private List outboundBridges = new CopyOnWriteArrayList();
@@ -67,8 +68,11 @@
     public boolean init(){
         boolean result=initialized.compareAndSet(false,true);
         if(result){
-            if(jndiTemplate==null){
-                jndiTemplate=new JndiTemplate();
+            if(jndiLocalTemplate==null){
+                jndiLocalTemplate=new JndiTemplate();
+            }
+            if(jndiOutboundTemplate==null){
+                jndiOutboundTemplate=new JndiTemplate();
             }
             if(jmsMessageConvertor==null){
                 jmsMessageConvertor=new SimpleJmsMessageConvertor();
@@ -117,16 +121,30 @@
     /**
      * @return Returns the jndiTemplate.
      */
-    public JndiTemplate getJndiTemplate(){
-        return jndiTemplate;
+    public JndiTemplate getJndiLocalTemplate(){
+        return jndiLocalTemplate;
     }
 
     /**
      * @param jndiTemplate
      *            The jndiTemplate to set.
      */
-    public void setJndiTemplate(JndiTemplate jndiTemplate){
-        this.jndiTemplate=jndiTemplate;
+    public void setJndiLocalTemplate(JndiTemplate jndiTemplate){
+        this.jndiLocalTemplate=jndiTemplate;
+    }
+
+    /**
+     * @return Returns the jndiOutboundTemplate.
+     */
+    public JndiTemplate getJndiOutboundTemplate(){
+        return jndiOutboundTemplate;
+    }
+
+    /**
+     * @param jndiOutboundTemplate The jndiOutboundTemplate to set.
+     */
+    public void setJndiOutboundTemplate(JndiTemplate jndiOutboundTemplate){
+        this.jndiOutboundTemplate=jndiOutboundTemplate;
     }
 
     /**

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java?rev=374729&r1=374728&r2=374729&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsQueueConnector.java
Fri Feb  3 11:22:40 2006
@@ -269,7 +269,7 @@
             if(outboundQueueConnectionFactory==null){
                 // look it up from JNDI
                 if(outboundQueueConnectionFactoryName!=null){
-                    outboundQueueConnectionFactory=(QueueConnectionFactory) jndiTemplate.lookup(
+                    outboundQueueConnectionFactory=(QueueConnectionFactory) jndiOutboundTemplate.lookup(
                                     outboundQueueConnectionFactoryName,QueueConnectionFactory.class);
                     if(outboundUsername!=null){
                         outboundQueueConnection=outboundQueueConnectionFactory.createQueueConnection(outboundUsername,
@@ -299,7 +299,7 @@
                 if(embeddedConnectionFactory==null){
                     // look it up from JNDI
                     if(localConnectionFactoryName!=null){
-                        localQueueConnectionFactory=(QueueConnectionFactory) jndiTemplate.lookup(
+                        localQueueConnectionFactory=(QueueConnectionFactory) jndiLocalTemplate.lookup(
                                         localConnectionFactoryName,QueueConnectionFactory.class);
                         if(localUsername!=null){
                             localQueueConnection=localQueueConnectionFactory.createQueueConnection(localUsername,
@@ -418,7 +418,7 @@
         }catch(JMSException e){
             //look-up the Queue
             try{
-                result = (Queue) jndiTemplate.lookup(queueName, Queue.class);
+                result = (Queue) jndiOutboundTemplate.lookup(queueName, Queue.class);
             }catch(NamingException e1){
                 String errStr = "Failed to look-up Queue for name: " + queueName;
                 log.error(errStr,e);

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java?rev=374729&r1=374728&r2=374729&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/jms/JmsTopicConnector.java
Fri Feb  3 11:22:40 2006
@@ -269,7 +269,7 @@
             if(outboundTopicConnectionFactory==null){
                 // look it up from JNDI
                 if(outboundTopicConnectionFactoryName!=null){
-                    outboundTopicConnectionFactory=(TopicConnectionFactory) jndiTemplate.lookup(
+                    outboundTopicConnectionFactory=(TopicConnectionFactory) jndiOutboundTemplate.lookup(
                                     outboundTopicConnectionFactoryName,TopicConnectionFactory.class);
                     if(outboundUsername!=null){
                         outboundTopicConnection=outboundTopicConnectionFactory.createTopicConnection(outboundUsername,
@@ -299,7 +299,7 @@
                 if(embeddedConnectionFactory==null){
                     // look it up from JNDI
                     if(localConnectionFactoryName!=null){
-                        localTopicConnectionFactory=(TopicConnectionFactory) jndiTemplate.lookup(
+                        localTopicConnectionFactory=(TopicConnectionFactory) jndiLocalTemplate.lookup(
                                         localConnectionFactoryName,TopicConnectionFactory.class);
                         if(localUsername!=null){
                             localTopicConnection=localTopicConnectionFactory.createTopicConnection(localUsername,
@@ -418,7 +418,7 @@
         }catch(JMSException e){
             //look-up the Topic
             try{
-                result = (Topic) jndiTemplate.lookup(topicName, Topic.class);
+                result = (Topic) jndiOutboundTemplate.lookup(topicName, Topic.class);
             }catch(NamingException e1){
                 String errStr = "Failed to look-up Topic for name: " + topicName;
                 log.error(errStr,e);



Mime
View raw message