Skip to content

Commit 208ead4

Browse files
committed
merge bug20680 into v1_5
2 parents 9dd1d05 + 069cf07 commit 208ead4

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

src/com/rabbitmq/client/Connection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
7575
ConnectionParameters getParameters();
7676

7777
/**
78-
* Get the negotiated maximum number of channels allowed.
78+
* Get the negotiated maximum channel number. Usable channel
79+
* numbers range from 1 to this number, inclusive.
7980
*
8081
* Note that this is the <i>current</i> setting, as opposed to the <i>initially-requested</i>
8182
* setting available from {@link #getParameters()}.{@link ConnectionParameters#getRequestedChannelMax()}.
8283
*
83-
* @return the maximum number of simultaneously-open channels permitted for this connection.
84+
* @return the maximum channel number permitted for this connection.
8485
*/
8586
int getChannelMax();
8687

src/com/rabbitmq/client/ConnectionParameters.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static String safeGetProperty(String key, String def) {
5454
/** Default virtual host */
5555
public static final String DEFAULT_VHOST = "/";
5656

57-
/** Default value for the desired maximum number of channels; zero for
57+
/** Default value for the desired maximum channel number; zero for
5858
* unlimited */
5959
public static final int DEFAULT_CHANNEL_MAX = 0;
6060

@@ -126,8 +126,8 @@ public void setVirtualHost(String virtualHost) {
126126
}
127127

128128
/**
129-
* Retrieve the requested maximum number of channels
130-
* @return the initially requested maximum number of channels; zero for unlimited
129+
* Retrieve the requested maximum channel number
130+
* @return the initially requested maximum channel number; zero for unlimited
131131
*/
132132
public int getRequestedChannelMax() {
133133
return _requestedChannelMax;
@@ -166,8 +166,8 @@ public void setRequestedHeartbeat(int requestedHeartbeat) {
166166
}
167167

168168
/**
169-
* Set the requested maximum number of channels
170-
* @param requestedChannelMax initially requested maximum number of channels; zero for unlimited
169+
* Set the requested maximum channel number
170+
* @param requestedChannelMax initially requested maximum channel number; zero for unlimited
171171
*/
172172
public void setRequestedChannelMax(int requestedChannelMax) {
173173
_requestedChannelMax = requestedChannelMax;

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public int getChannelMax() {
219219
}
220220

221221
/**
222-
* Protected API - set the max <b>number</b> of channels available
222+
* Protected API - set the max channel <b>number</b>
223223
*/
224224
public void setChannelMax(int value) {
225225
_channelManager.setChannelMax(value);

src/com/rabbitmq/client/impl/ChannelManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ChannelManager {
4747
/** Mapping from channel number to AMQChannel instance */
4848
private final Map<Integer, ChannelN> _channelMap = Collections.synchronizedMap(new HashMap<Integer, ChannelN>());
4949

50-
/** Maximum number of channels available on this connection. */
50+
/** Maximum channel number available on this connection. */
5151
public int _channelMax = 0;
5252

5353
public synchronized int getChannelMax() {
@@ -101,7 +101,7 @@ public synchronized int allocateChannelNumber(int maxChannels) {
101101
maxChannels = Integer.MAX_VALUE;
102102
}
103103
int channelNumber = -1;
104-
for (int candidate = 1; candidate < maxChannels; candidate++) {
104+
for (int candidate = 1; candidate <= maxChannels; candidate++) {
105105
if (!_channelMap.containsKey(candidate)) {
106106
channelNumber = candidate;
107107
break;

0 commit comments

Comments
 (0)