You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2015/11/13 12:40:06 UTC
svn commit: r1714191 - in
/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid:
amqp_1_0/transport/ConnectionEndpoint.java
server/protocol/v1_0/AMQPConnection_1_0.java
Author: rgodfrey
Date: Fri Nov 13 11:40:06 2015
New Revision: 1714191
URL: http://svn.apache.org/viewvc?rev=1714191&view=rev
Log:
QPID-6845 : Ensure inputClosed() calls the remoteClose handler for the connection
Modified:
qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java
qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java?rev=1714191&r1=1714190&r2=1714191&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java Fri Nov 13 11:40:06 2015
@@ -32,6 +32,7 @@ import java.security.NoSuchAlgorithmExce
import java.security.Principal;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -454,46 +455,50 @@ public class ConnectionEndpoint implemen
}
}
- public synchronized void inputClosed()
+ public void inputClosed()
{
- if (!_closedForInput)
+ List<Runnable> postLockActions;
+
+ synchronized (this)
{
- _closedForInput = true;
- _logger.received(_remoteAddress,(short)-1,"Underlying connection closed");
- switch (_state)
- {
- case UNOPENED:
- case AWAITING_OPEN:
- case CLOSE_SENT:
- _state = ConnectionState.CLOSED;
- closeSender();
- break;
- case OPEN:
- _state = ConnectionState.CLOSE_RECEIVED;
- case CLOSED:
- // already sent our close - too late to do anything more
- break;
- default:
- }
- if (_receivingSessions != null)
+ if (!_closedForInput)
{
- for (int i = 0; i < _receivingSessions.length; i++)
+ _closedForInput = true;
+ _logger.received(_remoteAddress, (short) -1, "Underlying connection closed");
+ switch (_state)
{
- if (_receivingSessions[i] != null)
- {
- _receivingSessions[i].end();
- _receivingSessions[i] = null;
-
- }
+ case UNOPENED:
+ case AWAITING_OPEN:
+ case CLOSE_SENT:
+ _state = ConnectionState.CLOSED;
+ closeSender();
+ break;
+ case OPEN:
+ _state = ConnectionState.CLOSE_RECEIVED;
+ case CLOSED:
+ // already sent our close - too late to do anything more
+ break;
+ default:
}
+ if (_connectionEventListener != null)
+ {
+ _connectionEventListener.closeReceived();
+ }
+ postLockActions = _postLockActions;
+ _postLockActions = new ArrayList<>();
}
- if(_connectionEventListener != null)
+ else
{
- _connectionEventListener.closeReceived();
+ postLockActions = Collections.emptyList();
}
+ notifyAll();
}
- notifyAll();
- }
+ for(Runnable action : postLockActions)
+ {
+ action.run();
+ }
+
+}
private void sendClose(Close closeToSend)
{
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java?rev=1714191&r1=1714190&r2=1714191&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java Fri Nov 13 11:40:06 2015
@@ -441,17 +441,8 @@ public class AMQPConnection_1_0 extends
{
try
{
- try
- {
- _endpoint.inputClosed();
- }
- finally
- {
- if (_endpoint != null && _endpoint.getConnectionEventListener() != null)
- {
- ((Connection_1_0) _endpoint.getConnectionEventListener()).closed();
- }
- }
+ _endpoint.inputClosed();
+
}
catch(RuntimeException e)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org