From 4c19b294416de85a744b4b0d439465e8f206a390 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Tue, 27 Mar 2007 16:36:34 +0000 Subject: Added additional logging and comments git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@522990 13f79535-47bb-0310-9956-ffa450edef68 --- java/client/src/main/java/org/apache/qpid/client/AMQSession.java | 8 +++++--- .../org/apache/qpid/client/handler/ChannelCloseMethodHandler.java | 2 ++ .../java/org/apache/qpid/client/protocol/AMQProtocolHandler.java | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'java/client/src') diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java index 184bc44912..6ff281b14e 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQSession.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQSession.java @@ -1248,8 +1248,10 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi { JMSException ex = new JMSException("Error registering consumer: " + e); - //todo remove - e.printStackTrace(); + if (_logger.isDebugEnabled()) + { + e.printStackTrace(); + } ex.setLinkedException(e); throw ex; } @@ -2089,7 +2091,7 @@ public class AMQSession extends Closeable implements Session, QueueSession, Topi // Remove the consumer from the map BasicMessageConsumer consumer = (BasicMessageConsumer) _consumers.get(consumerTag); if (consumer != null) - { + { // fixme this isn't right.. needs to check if _queue contains data for this consumer if (consumer.isAutoClose())// && _queue.isEmpty()) { diff --git a/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java b/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java index e2b101ab79..f62baf2c3a 100644 --- a/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java +++ b/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java @@ -94,6 +94,8 @@ public class ChannelCloseMethodHandler implements StateAwareMethodListener } } + //fixme why is this only done when the close is expected... + // should the above forced closes not also cause a close? protocolSession.channelClosed(evt.getChannelId(), errorCode, String.valueOf(reason)); } } diff --git a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java index d0cc52271a..1299145ff2 100644 --- a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java +++ b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java @@ -34,6 +34,7 @@ import org.apache.qpid.AMQConnectionClosedException; import org.apache.qpid.AMQDisconnectedException; import org.apache.qpid.AMQException; import org.apache.qpid.AMQTimeoutException; +import org.apache.qpid.AMQChannelClosedException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQSession; import org.apache.qpid.client.SSLConfiguration; @@ -248,6 +249,12 @@ public class AMQProtocolHandler extends IoHandlerAdapter sessionClosed(session); } + + //FIXME Need to correctly handle other exceptions. Things like ... +// if (cause instanceof AMQChannelClosedException) + // which will cause the JMSSession to end due to a channel close and so that Session needs + // to be removed from the map so we can correctly still call close without an exception when trying to close + // the server closed session. See also CloseChannelMethodHandler as the sessionClose is never called on exception } // we reach this point if failover was attempted and failed therefore we need to let the calling app // know since we cannot recover the situation -- cgit v1.2.1