diff options
| author | Robert Gemmell <robbie@apache.org> | 2011-08-08 22:54:37 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2011-08-08 22:54:37 +0000 |
| commit | 12181a6cd1fde75d48d4c048d9dd704e2f901524 (patch) | |
| tree | cc5e1f99d40c5703f59302fe357d4c9823c7ed21 /java/common/src/main | |
| parent | 04ee94c3acc0f2240af0eb39f037d7bf096c019d (diff) | |
| download | qpid-python-12181a6cd1fde75d48d4c048d9dd704e2f901524.tar.gz | |
QPID-3385: assign IDs from a generator within the MultiVersionProtocolEngineFactory, which is shared across all protocol versions
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1155136 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src/main')
3 files changed, 36 insertions, 22 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/protocol/ServerProtocolEngine.java b/java/common/src/main/java/org/apache/qpid/protocol/ServerProtocolEngine.java new file mode 100644 index 0000000000..e8362f79f0 --- /dev/null +++ b/java/common/src/main/java/org/apache/qpid/protocol/ServerProtocolEngine.java @@ -0,0 +1,29 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.protocol; + +public interface ServerProtocolEngine extends ProtocolEngine +{ + /** + * Gets the connection ID associated with this ProtocolEngine + */ + long getConnectionId(); +} diff --git a/java/common/src/main/java/org/apache/qpid/transport/Connection.java b/java/common/src/main/java/org/apache/qpid/transport/Connection.java index 7d17397b2d..eef6c047d3 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/Connection.java +++ b/java/common/src/main/java/org/apache/qpid/transport/Connection.java @@ -126,8 +126,6 @@ public class Connection extends ConnectionInvoker private SecurityLayer securityLayer; private String _clientId; - private static final AtomicLong idGenerator = new AtomicLong(0); - private final long _connectionId = idGenerator.incrementAndGet(); private final AtomicBoolean connectionLost = new AtomicBoolean(false); public Connection() {} @@ -360,11 +358,6 @@ public class Connection extends ConnectionInvoker _sessionFactory = sessionFactory; } - public long getConnectionId() - { - return _connectionId; - } - public ConnectionDelegate getConnectionDelegate() { return delegate; diff --git a/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java b/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java index 11af86f412..82fa6ca473 100644 --- a/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java +++ b/java/common/src/main/java/org/apache/qpid/transport/ServerDelegate.java @@ -170,22 +170,7 @@ public class ServerDelegate extends ConnectionDelegate @Override public void connectionTuneOk(Connection conn, ConnectionTuneOk ok) { - int okChannelMax = ok.getChannelMax(); - - if (okChannelMax > getChannelMax()) - { - _logger.error("Connection '" + conn.getConnectionId() + "' being severed, " + - "client connectionTuneOk returned a channelMax (" + okChannelMax + - ") above the servers offered limit (" + getChannelMax() +")"); - - //Due to the error we must forcefully close the connection without negotiation - conn.getSender().close(); - return; - } - //0 means no implied limit, except available server resources - //(or that forced by protocol limitations [0xFFFF]) - conn.setChannelMax(okChannelMax == 0 ? Connection.MAX_CHANNEL_MAX : okChannelMax); } @Override @@ -215,4 +200,11 @@ public class ServerDelegate extends ConnectionDelegate ssn.sessionAttached(atc.getName()); ssn.setState(Session.State.OPEN); } + + protected void setConnectionTuneOkChannelMax(final Connection conn, final int okChannelMax) + { + //0 means no implied limit, except available server resources + //(or that forced by protocol limitations [0xFFFF]) + conn.setChannelMax(okChannelMax == 0 ? Connection.MAX_CHANNEL_MAX : okChannelMax); + } } |
