diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-10-28 15:27:29 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-10-28 15:27:29 +0000 |
| commit | 84270a757d3d3c4e801a6f5e683a1f3a5fdcf0e3 (patch) | |
| tree | 455c13233d15fd220f784f3546904ba05f76e453 /qpid/java | |
| parent | f791d3b16bd935284b312ce80fbee6a904e9e681 (diff) | |
| download | qpid-python-84270a757d3d3c4e801a6f5e683a1f3a5fdcf0e3.tar.gz | |
QPID-6193 : [Java AMQP 1.0] Allow channel max to be successfully established as between 2^15 and 2^16 - 1
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1634893 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java index 9e7e4afeb2..766c9705a1 100644 --- a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java +++ b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ConnectionEndpoint.java @@ -89,13 +89,13 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour private final Container _container; private Principal _user; - private static final short DEFAULT_CHANNEL_MAX = Integer.getInteger("amqp.channel_max", 255).shortValue(); + private static final int DEFAULT_CHANNEL_MAX = Math.min(Integer.getInteger("amqp.channel_max", 255), 0xFFFF); private static final int DEFAULT_MAX_FRAME = Integer.getInteger("amqp.max_frame_size", 1 << 15); private static final long DEFAULT_SYNC_TIMEOUT = Long.getLong("amqp.connection_sync_timeout", 5000l); private ConnectionState _state = ConnectionState.UNOPENED; - private short _channelMax = DEFAULT_CHANNEL_MAX; + private int _channelMax = DEFAULT_CHANNEL_MAX; private int _maxFrameSize = 4096; private String _remoteContainerId; @@ -259,7 +259,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour return _user; } - public short getChannelMax() + public int getChannelMax() { return _channelMax; } @@ -274,7 +274,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour return _remoteContainerId; } - private void sendOpen(final short channelMax, final int maxFrameSize) + private void sendOpen(final int channelMax, final int maxFrameSize) { Open open = new Open(); @@ -287,7 +287,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour { _channelMax = channelMax; } - open.setChannelMax(UnsignedShort.valueOf(channelMax)); + open.setChannelMax(UnsignedShort.valueOf((short) channelMax)); open.setContainerId(_container.getId()); open.setMaxFrameSize(getDesiredMaxFrameSize()); open.setHostname(getRemoteHostname()); @@ -349,8 +349,8 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour { _channelMax = open.getChannelMax() == null ? _channelMax - : open.getChannelMax().shortValue() < _channelMax - ? open.getChannelMax().shortValue() + : open.getChannelMax().intValue() < _channelMax + ? open.getChannelMax().intValue() : _channelMax; if (_receivingSessions == null) @@ -429,7 +429,7 @@ public class ConnectionEndpoint implements DescribedTypeConstructorRegistry.Sour switch (_state) { case UNOPENED: - sendOpen((short) 0, 0); + sendOpen(0, 0); sendClose(close); _state = ConnectionState.CLOSED; break; |
