qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1614893 - /qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
Date Thu, 31 Jul 2014 13:51:19 GMT
Author: kwall
Date: Thu Jul 31 13:51:18 2014
New Revision: 1614893

URL: http://svn.apache.org/r1614893
Log:
QPID-5915: [Java Broker] Guard the case where client and server sides race to close the same
connection.

This change reuses the approach taken by ConnectionRegistry when the Broker is shutdown. 
Namely, it logs the failure
and continues to allow the Broker to shutdown.

Modified:
    qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java?rev=1614893&r1=1614892&r2=1614893&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
(original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
Thu Jul 31 13:51:18 2014
@@ -27,6 +27,8 @@ import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.log4j.Logger;
+
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.server.model.AbstractConfiguredObject;
 import org.apache.qpid.server.model.ConfiguredObject;
@@ -44,6 +46,8 @@ import org.apache.qpid.server.util.Actio
 public final class ConnectionAdapter extends AbstractConfiguredObject<ConnectionAdapter>
implements Connection<ConnectionAdapter>,
                                                                                         
    SessionModelListener
 {
+    private static final Logger LOGGER = Logger.getLogger(ConnectionAdapter.class);
+
     private final Action _underlyingConnectionDeleteTask;
     private final AtomicBoolean _underlyingClosed = new AtomicBoolean(false);
     private AMQConnectionModel _underlyingConnection;
@@ -61,6 +65,7 @@ public final class ConnectionAdapter ext
             @Override
             public void performAction(final Object object)
             {
+                System.out.println("Got underlying delete");
                 conn.removeDeleteTask(this);
                 _underlyingClosed.set(true);
                 deleted();
@@ -240,7 +245,18 @@ public final class ConnectionAdapter ext
         if (_underlyingClosed.compareAndSet(false, true))
         {
             _underlyingConnection.removeDeleteTask(_underlyingConnectionDeleteTask);
-            _underlyingConnection.close(AMQConstant.CONNECTION_FORCED, "Connection closed
by external action");
+            try
+            {
+                _underlyingConnection.close(AMQConstant.CONNECTION_FORCED, "Connection closed
by external action");
+            }
+            catch (Exception e)
+            {
+                LOGGER.warn("Exception closing connection "
+                             + _underlyingConnection.getConnectionId()
+                             + " from "
+                             + _underlyingConnection.getRemoteAddressString(), e);
+            }
+
         }
     }
 



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


Mime
View raw message