summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java63
1 files changed, 46 insertions, 17 deletions
diff --git a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
index d3f48fc664..b2b2f904a6 100644
--- a/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
+++ b/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
@@ -727,17 +727,41 @@ public class AMQProtocolEngine implements ServerProtocolEngine,
*/
private void closeAllChannels()
{
- for (AMQChannel channel : getChannels())
- {
- channel.close();
- }
- synchronized (_channelMap)
+ try
{
- _channelMap.clear();
+ RuntimeException firstException = null;
+ for (AMQChannel channel : getChannels())
+ {
+ try
+ {
+ channel.close();
+ }
+ catch (RuntimeException re)
+ {
+ if (!(re instanceof ConnectionScopedRuntimeException))
+ {
+ _logger.error("Unexpected exception closing channel", re);
+ }
+ firstException = re;
+ }
+ }
+
+ if (firstException != null)
+ {
+ throw firstException;
+ }
}
- for (int i = 0; i <= CHANNEL_CACHE_SIZE; i++)
+ finally
{
- _cachedChannels[i] = null;
+ synchronized (_channelMap)
+ {
+ _channelMap.clear();
+ }
+ for (int i = 0; i <= CHANNEL_CACHE_SIZE; i++)
+ {
+ _cachedChannels[i] = null;
+ }
+
}
}
@@ -767,19 +791,24 @@ public class AMQProtocolEngine implements ServerProtocolEngine,
_virtualHost.getConnectionRegistry().deregisterConnection(this);
}
- closeAllChannels();
-
- for (Action<? super AMQProtocolEngine> task : _taskList)
+ try
{
- task.performAction(this);
+ closeAllChannels();
}
-
- synchronized(this)
+ finally
{
- _closed = true;
- notifyAll();
+ for (Action<? super AMQProtocolEngine> task : _taskList)
+ {
+ task.performAction(this);
+ }
+
+ synchronized (this)
+ {
+ _closed = true;
+ notifyAll();
+ }
+ getEventLogger().message(_logSubject, ConnectionMessages.CLOSE());
}
- getEventLogger().message(_logSubject, ConnectionMessages.CLOSE());
}
}
else