https://issues.apache.org/jira/browse/AMQ-3198 - unregister failed add connection but have unregister respect the reference count such that it is only removed if the refcount is 1

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1079885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-03-09 17:01:55 +00:00
parent 4f9784dafc
commit f93d05acef
2 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,10 @@ public class MapTransportConnectionStateRegister implements TransportConnection
public TransportConnectionState unregisterConnectionState(ConnectionId connectionId) {
TransportConnectionState rc = connectionStates.remove(connectionId);
if (rc.getReferenceCounter().get() > 1) {
rc.decrementReference();
connectionStates.put(connectionId, rc);
}
return rc;
}

View File

@ -697,6 +697,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
synchronized (brokerConnectionStates) {
brokerConnectionStates.remove(info.getConnectionId());
}
unregisterConnectionState(info.getConnectionId());
LOG.warn("Failed to add Connection " + info.getConnectionId() + ", reason: " + e.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Exception detail:", e);