You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by as...@apache.org on 2007/04/02 10:41:22 UTC

svn commit: r524744 - in /webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms: JMSConnectionFactory.java JMSSender.java

Author: asankha
Date: Mon Apr  2 01:41:14 2007
New Revision: 524744

URL: http://svn.apache.org/viewvc?view=rev&rev=524744
Log:
fix issue reported by Shantanau for JBoss and add a couple of lines of debug logging

Modified:
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSConnectionFactory.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSSender.java

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSConnectionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSConnectionFactory.java?view=diff&rev=524744&r1=524743&r2=524744
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSConnectionFactory.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSConnectionFactory.java Mon Apr  2 01:41:14 2007
@@ -180,32 +180,35 @@
 
         serviceJNDINameMapping.put(destinationJndi, serviceName);
         String destinationName = getDestinationName(destinationJndi);
-        log.warn("JMS Destination with JNDI name : " + destinationJndi + " does not exist");
 
-        Connection con = null;
-        try {
-            con = conFactory.createConnection();
-            Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue(destinationJndi);
-            destinationName = queue.getQueueName();
-            log.warn("JMS Destination with JNDI name : " + destinationJndi + " created");
-            
-        } catch (JMSException e) {
-            log.error("Unable to create a Destination with JNDI name : " + destinationJndi, e);
-            // mark service as faulty
-            JMSUtils.markServiceAsFaulty(
-                (String) serviceJNDINameMapping.get(destinationJndi),
-                "Error looking up JMS destination : " + destinationJndi,
-                msgRcvr.getAxisConf().getAxisConfiguration());
+        if (destinationName == null) {
+            log.warn("JMS Destination with JNDI name : " + destinationJndi + " does not exist");
 
-        } finally {
-            if (con != null) {
-                try {
-                    con.close();
-                } catch (JMSException ignore) {}
+            Connection con = null;
+            try {
+                con = conFactory.createConnection();
+                Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
+                Queue queue = session.createQueue(destinationJndi);
+                destinationName = queue.getQueueName();
+                log.warn("JMS Destination with JNDI name : " + destinationJndi + " created");
+
+            } catch (JMSException e) {
+                log.error("Unable to create a Destination with JNDI name : " + destinationJndi, e);
+                // mark service as faulty
+                JMSUtils.markServiceAsFaulty(
+                    (String) serviceJNDINameMapping.get(destinationJndi),
+                    "Error looking up JMS destination : " + destinationJndi,
+                    msgRcvr.getAxisConf().getAxisConfiguration());
+
+            } finally {
+                if (con != null) {
+                    try {
+                        con.close();
+                    } catch (JMSException ignore) {}
+                }
             }
         }
-
+        
         serviceDestinationMapping.put(destinationName, serviceName);
         log.info("Mapping JNDI name : " + destinationJndi + " and JMS Destination name : " +
             destinationName + " against service : " + serviceName);

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSSender.java?view=diff&rev=524744&r1=524743&r2=524744
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSSender.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/jms/JMSSender.java Mon Apr  2 01:41:14 2007
@@ -29,16 +29,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
+import javax.jms.*;
 import javax.xml.stream.XMLStreamException;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -103,12 +94,21 @@
             Destination dest = transportInfo.getDestination();
 
             if (dest == null) {
-                // if it does not exist, create it
-                String name = JMSUtils.getDestination(targetAddress);
-                try {
-                    dest = session.createQueue(name);
-                } catch (JMSException e) {
-                    handleException("Error creating destination Queue : " + name, e);
+                if (targetAddress != null) {
+
+                    // if it does not exist, create it
+                    String name = JMSUtils.getDestination(targetAddress);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Creating JMS Destination : " + name);
+                    }
+
+                    try {
+                        dest = session.createQueue(name);
+                    } catch (JMSException e) {
+                        handleException("Error creating destination Queue : " + name, e);
+                    }
+                } else {
+                    handleException("Cannot send reply to unknown JMS Destination");
                 }
             }
 
@@ -154,6 +154,11 @@
                     }
                 }
                 message.setJMSReplyTo(replyDest);
+                if (log.isDebugEnabled()) {
+                    log.debug("Expecting a response to JMS Destination : " +
+                        (replyDest instanceof Queue ?
+                            ((Queue) replyDest).getQueueName() : ((Topic) replyDest).getTopicName()));
+                }
             }
 
             try {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org