You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2018/05/04 10:34:42 UTC

qpid-jms-amqp-0-x git commit: QPID-8180: [Qpid JMS AMQP 0-8..0-91] Improve error message used to handle a channel not found condition during frame dispatch.

Repository: qpid-jms-amqp-0-x
Updated Branches:
  refs/heads/master f5fb52de7 -> e4e2b6b20


QPID-8180: [Qpid JMS AMQP 0-8..0-91] Improve error message used to handle a channel not found condition during frame dispatch.


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/commit/e4e2b6b2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/tree/e4e2b6b2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/diff/e4e2b6b2

Branch: refs/heads/master
Commit: e4e2b6b206c8d232f01a7527a0a884abb957be53
Parents: f5fb52d
Author: Keith Wall <kw...@apache.org>
Authored: Fri May 4 11:33:52 2018 +0100
Committer: Keith Wall <kw...@apache.org>
Committed: Fri May 4 11:34:23 2018 +0100

----------------------------------------------------------------------
 .../qpid/client/protocol/AMQProtocolSession.java    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms-amqp-0-x/blob/e4e2b6b2/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java b/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
index 1739a78..51eb4cf 100644
--- a/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
+++ b/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
@@ -73,7 +73,7 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession
 
     private final AMQProtocolHandler _protocolHandler;
 
-    private ConcurrentMap<Integer,AMQSession<?,?>> _closingChannels = new ConcurrentHashMap<>();
+    private final ConcurrentMap<Integer,AMQSession<?,?>> _closingChannels = new ConcurrentHashMap<>();
 
     /**
      * Maps from a channel id to an unprocessed message. This is used to tie together the JmsDeliverBody (which arrives
@@ -317,7 +317,19 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession
 
     protected AMQSession getSession(int channelId)
     {
-        return _connection.getSession(channelId);
+        AMQSession session = _connection.getSession(channelId);
+        if (session == null)
+        {
+            if (_closingChannels.containsKey(channelId))
+            {
+                throw new IllegalStateException(String.format("Channel %d is being closed.", channelId));
+            }
+            else
+            {
+                throw new IllegalStateException(String.format("Channel %d does not exist", channelId));
+            }
+        }
+        return session;
     }
 
     @Override


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