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 2014/10/30 17:58:52 UTC
svn commit: r1635548 -
/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
Author: kwall
Date: Thu Oct 30 16:58:52 2014
New Revision: 1635548
URL: http://svn.apache.org/r1635548
Log:
QPID-6202: [Java Broker] Ensure AMQProtocolEngine#closeSession() completes closure even if AMQChannel fails to close cleanly
Modified:
qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java?rev=1635548&r1=1635547&r2=1635548&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java Thu Oct 30 16:58:52 2014
@@ -727,17 +727,41 @@ public class AMQProtocolEngine implement
*/
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 implement
_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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org