qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r1063123 - in /qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client: AMQSession.java AMQSession_0_10.java AMQSession_0_8.java BasicMessageProducer.java BasicMessageProducer_0_10.java BasicMessageProducer_0_8.java
Date Tue, 25 Jan 2011 03:23:22 GMT
Author: rajith
Date: Tue Jan 25 03:23:22 2011
New Revision: 1063123

URL: http://svn.apache.org/viewvc?rev=1063123&view=rev
Log:
QPID-3019
The createMessageProducer method now throws a JMSException.
The MessageProducer constructors now throw an AMQException allowing any exceptions caught
during destination validation to be propogated back to the createMessageProducer method.
Fixed the exception handling for the 0-10 code path where all exceptions are chained properly.
This allows the user to get all the relavent information by examing the stack trace.

Modified:
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?rev=1063123&r1=1063122&r2=1063123&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Tue Jan
25 03:23:22 2011
@@ -2566,7 +2566,7 @@ public abstract class AMQSession<C exten
     }
 
     public abstract P createMessageProducer(final Destination destination, final boolean
mandatory,
-                                                               final boolean immediate, final
boolean waitUntilSent, long producerId);
+                                                               final boolean immediate, final
boolean waitUntilSent, long producerId) throws JMSException;
 
     private void declareExchange(AMQDestination amqd, AMQProtocolHandler protocolHandler,
boolean nowait) throws AMQException
     {

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java?rev=1063123&r1=1063122&r2=1063123&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_10.java
Tue Jan 25 03:23:22 2011
@@ -660,10 +660,21 @@ public class AMQSession_0_10 extends AMQ
      */
     public BasicMessageProducer_0_10 createMessageProducer(final Destination destination,
final boolean mandatory,
                                                       final boolean immediate, final boolean
waitUntilSent,
-                                                      long producerId)
+                                                      long producerId) throws JMSException
     {
-        return new BasicMessageProducer_0_10(_connection, (AMQDestination) destination, _transacted,
_channelId, this,
+        try
+        {
+            return new BasicMessageProducer_0_10(_connection, (AMQDestination) destination,
_transacted, _channelId, this,
                                              getProtocolHandler(), producerId, immediate,
mandatory, waitUntilSent);
+        }
+        catch (AMQException e)
+        {
+            JMSException ex = new JMSException("Error creating producer");
+            ex.initCause(e);
+            ex.setLinkedException(e);
+            
+            throw ex;
+        }
 
     }
 

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java?rev=1063123&r1=1063122&r2=1063123&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java Tue
Jan 25 03:23:22 2011
@@ -400,11 +400,21 @@ public final class AMQSession_0_8 extend
 
 
     public BasicMessageProducer_0_8 createMessageProducer(final Destination destination,
final boolean mandatory,
-            final boolean immediate, final boolean waitUntilSent, long producerId)
+            final boolean immediate, final boolean waitUntilSent, long producerId) throws
JMSException
     {
-
-       return new BasicMessageProducer_0_8(_connection, (AMQDestination) destination, _transacted,
_channelId,
+       try
+       {
+           return new BasicMessageProducer_0_8(_connection, (AMQDestination) destination,
_transacted, _channelId,
                                  this, getProtocolHandler(), producerId, immediate, mandatory,
waitUntilSent);
+       }
+       catch (AMQException e)
+       {
+           JMSException ex = new JMSException("Error creating producer");
+           ex.initCause(e);
+           ex.setLinkedException(e);
+           
+           throw ex;
+       }
     }
 
 

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java?rev=1063123&r1=1063122&r2=1063123&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
Tue Jan 25 03:23:22 2011
@@ -127,7 +127,7 @@ public abstract class BasicMessageProduc
 
     protected BasicMessageProducer(AMQConnection connection, AMQDestination destination,
boolean transacted, int channelId,
                                    AMQSession session, AMQProtocolHandler protocolHandler,
long producerId, boolean immediate, boolean mandatory,
-                                   boolean waitUntilSent)
+                                   boolean waitUntilSent) throws AMQException
     {
         _connection = connection;
         _destination = destination;
@@ -175,7 +175,7 @@ public abstract class BasicMessageProduc
         }
     }
 
-    abstract void declareDestination(AMQDestination destination);
+    abstract void declareDestination(AMQDestination destination) throws AMQException;
 
     public void setDisableMessageID(boolean b) throws JMSException
     {
@@ -434,7 +434,18 @@ public abstract class BasicMessageProduc
         AMQDestination amqDestination = (AMQDestination) destination;
         if(!amqDestination.isExchangeExistsChecked())
         {
-            declareDestination(amqDestination);
+            try
+            {
+                declareDestination(amqDestination);
+            }
+            catch(Exception e)
+            {
+                JMSException ex = new JMSException("Error validating destination");
+                ex.initCause(e);
+                ex.setLinkedException(e);
+                
+                throw ex;
+            }
             amqDestination.setExchangeExistsChecked(true);
         }
     }

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java?rev=1063123&r1=1063122&r2=1063123&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java
Tue Jan 25 03:23:22 2011
@@ -56,7 +56,7 @@ public class BasicMessageProducer_0_10 e
 
     BasicMessageProducer_0_10(AMQConnection connection, AMQDestination destination, boolean
transacted, int channelId,
                               AMQSession session, AMQProtocolHandler protocolHandler, long
producerId,
-                              boolean immediate, boolean mandatory, boolean waitUntilSent)
+                              boolean immediate, boolean mandatory, boolean waitUntilSent)
throws AMQException
     {
         super(connection, destination, transacted, channelId, session, protocolHandler, producerId,
immediate,
               mandatory, waitUntilSent);
@@ -64,7 +64,7 @@ public class BasicMessageProducer_0_10 e
         userIDBytes = Strings.toUTF8(_userID);
     }
 
-    void declareDestination(AMQDestination destination)
+    void declareDestination(AMQDestination destination) throws AMQException
     {
         if (destination.getDestSyntax() == DestSyntax.BURL)
         {
@@ -83,8 +83,8 @@ public class BasicMessageProducer_0_10 e
             }
             catch(Exception e)
             {
-                // Idealy this should be thrown to the JMS layer.
-                _logger.warn("Exception occured while verifying destination",e);
+                AMQException ex = new AMQException("Exception occured while verifying destination",e);
               
+                throw ex;                
             }
         }
     }

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java?rev=1063123&r1=1063122&r2=1063123&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
Tue Jan 25 03:23:22 2011
@@ -28,6 +28,7 @@ import javax.jms.Topic;
 import javax.jms.Queue;
 
 import org.apache.mina.common.ByteBuffer;
+import org.apache.qpid.AMQException;
 import org.apache.qpid.client.message.AbstractJMSMessage;
 import org.apache.qpid.client.message.AMQMessageDelegate;
 import org.apache.qpid.client.message.AMQMessageDelegate_0_8;
@@ -46,7 +47,7 @@ public class BasicMessageProducer_0_8 ex
 
     BasicMessageProducer_0_8(AMQConnection connection, AMQDestination destination, boolean
transacted, int channelId,
             AMQSession session, AMQProtocolHandler protocolHandler, long producerId, boolean
immediate, boolean mandatory,
-            boolean waitUntilSent)
+            boolean waitUntilSent) throws AMQException
     {
         super(connection, destination,transacted,channelId,session, protocolHandler, producerId,
immediate, mandatory,waitUntilSent);
     }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message