Skip to content

Commit 2043b35

Browse files
author
David R. MacIver
committed
complain noisily rather than return null when get disagreement between ChannelMap and IntAllocator
1 parent ff3d52f commit 2043b35

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ public synchronized ChannelN createChannel(AMQConnection connection, int channel
107107

108108
private synchronized ChannelN createChannelInternal(AMQConnection connection, int channelNumber) throws IOException {
109109
if (_channelMap.containsKey(channelNumber)) {
110-
return null; // That number's already allocated! Can't do it
110+
// That number's already allocated! Can't do it
111+
// This should never happen unless something has gone
112+
// badly wrong with our implementation.
113+
throw new IllegalStateException("We have attempted to"
114+
+ "create a channel with a number that is already in"
115+
+ "use. This should never happen. Please report this as a bug.");
111116
}
112117
ChannelN ch = new ChannelN(connection, channelNumber);
113118
addChannel(ch);

0 commit comments

Comments
 (0)