qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1535362 - in /qpid/trunk/qpid/java: amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/
Date Thu, 24 Oct 2013 12:49:14 GMT
Author: rgodfrey
Date: Thu Oct 24 12:49:13 2013
New Revision: 1535362

URL: http://svn.apache.org/r1535362
Log:
QPID-5245 : Applied patch from David Ingham

Added:
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java
    qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ChannelsExhaustedException.java
Modified:
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
    qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
    qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java

Added: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java?rev=1535362&view=auto
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java
(added)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/ErrorCodes.java
Thu Oct 24 12:49:13 2013
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.qpid.amqp_1_0.jms;
+
+public interface ErrorCodes
+{
+    public static final String CHANNELS_EXHAUSTED = "org.apache:channels-exhausted";
+}

Added: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java?rev=1535362&view=auto
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java
(added)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageConsumerException.java
Thu Oct 24 12:49:13 2013
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.qpid.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+public class MessageConsumerException extends JMSException
+{
+    private String _destinationName = null;
+
+    public MessageConsumerException(String reason)
+    {
+        super(reason);
+    }
+
+    public MessageConsumerException(String reason, String errorCode)
+    {
+        super(reason, errorCode);
+    }
+
+    public MessageConsumerException(String reason, String errorCode, String destinationName)
+    {
+        super(reason, errorCode);
+        _destinationName = destinationName;
+    }
+
+    public String getDestinationName()
+    {
+        return _destinationName;
+    }
+}

Added: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java?rev=1535362&view=auto
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java
(added)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/MessageProducerException.java
Thu Oct 24 12:49:13 2013
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.qpid.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+public class MessageProducerException extends JMSException
+{
+    private String _destinationName = null;
+
+    public MessageProducerException(String reason)
+    {
+        super(reason);
+    }
+
+    public MessageProducerException(String reason, String errorCode)
+    {
+        super(reason, errorCode);
+    }
+
+    public MessageProducerException(String reason, String errorCode, String destinationName)
+    {
+        super(reason, errorCode);
+        _destinationName = destinationName;
+    }
+
+    public String getDestinationName()
+    {
+        return _destinationName;
+    }
+}

Added: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java?rev=1535362&view=auto
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java
(added)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/SessionException.java
Thu Oct 24 12:49:13 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.qpid.amqp_1_0.jms;
+
+import javax.jms.JMSException;
+
+public class SessionException extends JMSException
+{
+    public SessionException(String reason)
+    {
+        super(reason);
+    }
+
+    public SessionException(String reason, String errorCode)
+    {
+        super(reason, errorCode);
+    }
+
+}

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?rev=1535362&r1=1535361&r2=1535362&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
Thu Oct 24 12:49:13 2013
@@ -43,6 +43,7 @@ import org.apache.qpid.amqp_1_0.jms.Sess
 import org.apache.qpid.amqp_1_0.jms.TemporaryDestination;
 import org.apache.qpid.amqp_1_0.jms.Topic;
 import org.apache.qpid.amqp_1_0.jms.TopicSubscriber;
+import org.apache.qpid.amqp_1_0.jms.MessageConsumerException;
 import org.apache.qpid.amqp_1_0.type.Binary;
 import org.apache.qpid.amqp_1_0.type.Symbol;
 import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
@@ -130,9 +131,13 @@ public class MessageConsumerImpl impleme
                     if(exceptionListener != null)
                     {
                         final Error receiverError = _receiver.getError();
-                        exceptionListener.onException(new JMSException(receiverError.getDescription(),
-                                receiverError.getCondition().getValue().toString()));
 
+                        MessageConsumerException mce = new MessageConsumerException(
+                                receiverError.getDescription(),
+                                receiverError.getCondition().getValue().toString(),
+                                _destination.getAddress());
+
+                        exceptionListener.onException(mce);
                     }
                 }
                 catch (JMSException e)

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java?rev=1535362&r1=1535361&r2=1535362&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageProducerImpl.java
Thu Oct 24 12:49:13 2013
@@ -22,6 +22,7 @@ import org.apache.qpid.amqp_1_0.client.*
 import org.apache.qpid.amqp_1_0.client.Session;
 import org.apache.qpid.amqp_1_0.jms.MessageProducer;
 import org.apache.qpid.amqp_1_0.jms.MessageRejectedException;
+import org.apache.qpid.amqp_1_0.jms.MessageProducerException;
 import org.apache.qpid.amqp_1_0.jms.QueueSender;
 import org.apache.qpid.amqp_1_0.jms.TemporaryDestination;
 import org.apache.qpid.amqp_1_0.jms.TopicPublisher;
@@ -112,9 +113,13 @@ public class MessageProducerImpl impleme
                                 if(exceptionListener != null)
                                 {
                                     final org.apache.qpid.amqp_1_0.type.transport.Error receiverError
= _sender.getError();
-                                    exceptionListener.onException(new JMSException(receiverError.getDescription(),
-                                            receiverError.getCondition().getValue().toString()));
 
+                                    MessageProducerException mpe = new MessageProducerException(
+                                            receiverError.getDescription(),
+                                            receiverError.getCondition().getValue().toString(),
+                                            _destination.getAddress());
+
+                                    exceptionListener.onException(mpe);
                                 }
                             }
                             catch (JMSException e)

Modified: qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java?rev=1535362&r1=1535361&r2=1535362&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/SessionImpl.java
Thu Oct 24 12:49:13 2013
@@ -42,6 +42,7 @@ import org.apache.qpid.amqp_1_0.client.C
 import org.apache.qpid.amqp_1_0.client.ConnectionClosedException;
 import org.apache.qpid.amqp_1_0.client.ConnectionErrorException;
 import org.apache.qpid.amqp_1_0.client.ConnectionException;
+import org.apache.qpid.amqp_1_0.client.ChannelsExhaustedException;
 import org.apache.qpid.amqp_1_0.client.Message;
 import org.apache.qpid.amqp_1_0.client.Receiver;
 import org.apache.qpid.amqp_1_0.client.Sender;
@@ -54,6 +55,8 @@ import org.apache.qpid.amqp_1_0.jms.Temp
 import org.apache.qpid.amqp_1_0.jms.TopicPublisher;
 import org.apache.qpid.amqp_1_0.jms.TopicSession;
 import org.apache.qpid.amqp_1_0.jms.TopicSubscriber;
+import org.apache.qpid.amqp_1_0.jms.ErrorCodes;
+import org.apache.qpid.amqp_1_0.jms.SessionException;
 import org.apache.qpid.amqp_1_0.transport.SessionEventListener;
 import org.apache.qpid.amqp_1_0.type.messaging.Source;
 import org.apache.qpid.amqp_1_0.type.messaging.Target;
@@ -90,7 +93,15 @@ public class SessionImpl implements Sess
         }
         catch (ConnectionException e)
         {
-            final JMSException jmsException = new JMSException(e.getMessage());
+            JMSException jmsException;
+            if (e instanceof ChannelsExhaustedException)
+            {
+                jmsException = new JMSException(e.getMessage(), ErrorCodes.CHANNELS_EXHAUSTED);
+            }
+            else
+            {
+                jmsException = new JMSException(e.getMessage());
+            }
             jmsException.setLinkedException(e);
             throw jmsException;
         }
@@ -116,12 +127,15 @@ public class SessionImpl implements Sess
                         {
                             if(error != null)
                             {
-                                exceptionListener.onException(new JMSException(error.getDescription(),
-                                        error.getCondition().getValue().toString()));
+                                SessionException se = new SessionException(
+                                        error.getDescription(),
+                                        error.getCondition().getValue().toString());
+
+                                exceptionListener.onException(se);
                             }
                             else
                             {
-                                exceptionListener.onException(new JMSException("Session remotely
closed"));
+                                exceptionListener.onException(new SessionException("Session
remotely closed"));
                             }
                         }
                     }

Added: qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ChannelsExhaustedException.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ChannelsExhaustedException.java?rev=1535362&view=auto
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ChannelsExhaustedException.java
(added)
+++ qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ChannelsExhaustedException.java
Thu Oct 24 12:49:13 2013
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.amqp_1_0.client;
+
+public class ChannelsExhaustedException extends ConnectionException
+{
+    protected ChannelsExhaustedException(final String message)
+    {
+        super(message);
+    }
+
+    public ChannelsExhaustedException(Throwable cause)
+    {
+        super(cause);
+    }
+
+    ChannelsExhaustedException()
+    {
+
+    }
+}

Modified: qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java?rev=1535362&r1=1535361&r2=1535362&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java
(original)
+++ qpid/trunk/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Session.java
Thu Oct 24 12:49:13 2013
@@ -51,13 +51,13 @@ public class Session
     private TransactionController _sessionLocalTC;
     private Connection _connection;
 
-    public Session(final Connection connection, String name) throws SessionCreationException
+    public Session(final Connection connection, String name) throws ChannelsExhaustedException
     {
         _connection = connection;
         _endpoint = connection.getEndpoint().createSession(name);
         if(_endpoint == null)
         {
-            throw new SessionCreationException("Cannot create session as all channels are
in use");
+            throw new ChannelsExhaustedException("Cannot create session as all channels are
in use");
         }
         _sectionEncoder = new SectionEncoderImpl(connection.getEndpoint().getDescribedTypeRegistry());
         _sectionDecoder = new SectionDecoderImpl(connection.getEndpoint().getDescribedTypeRegistry());
@@ -389,14 +389,4 @@ public class Session
     {
         public void configureSource(final Source source);
     }
-
-    private class SessionCreationException extends ConnectionException
-    {
-
-        private SessionCreationException(final String message)
-        {
-            super(message);
-        }
-
-    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message