File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
src/com/rabbitmq/client/impl Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,8 @@ public class AMQConnection extends ShutdownNotifierComponent implements Connecti
113113 * Protected API - respond, in the driver thread, to a ShutdownSignal.
114114 * @param channelNumber the number of the channel to disconnect
115115 */
116- public final void disconnectChannel (int channelNumber ) {
117- _channelManager .disconnectChannel (channelNumber );
116+ public final void disconnectChannel (ChannelN channel ) {
117+ _channelManager .disconnectChannel (channel );
118118 }
119119
120120 public void ensureIsOpen ()
Original file line number Diff line number Diff line change @@ -86,8 +86,8 @@ public void handleSignal(ShutdownSignalException signal) {
8686 synchronized (_channelMap ) {
8787 channels = new HashSet <ChannelN >(_channelMap .values ());
8888 }
89- for (AMQChannel channel : channels ) {
90- disconnectChannel (channel . getChannelNumber () );
89+ for (ChannelN channel : channels ) {
90+ disconnectChannel (channel );
9191 channel .processShutdownSignal (signal , true , true );
9292 }
9393 }
@@ -126,13 +126,13 @@ private void addChannel(ChannelN chan) {
126126 _channelMap .put (chan .getChannelNumber (), chan );
127127 }
128128
129- public synchronized void disconnectChannel (int channelNumber ) {
130- if (_channelMap .remove (channelNumber ) == null )
129+ public synchronized void disconnectChannel (ChannelN channel ) {
130+ int channelNumber = channel .getChannelNumber ();
131+ if (_channelMap .remove (channelNumber ) != channel )
131132 throw new IllegalStateException (
132133 "We have attempted to "
133134 + "create a disconnect a channel that's no longer in "
134135 + "use. This should never happen. Please report this as a bug." );
135- System .err .println ("DISCONN CH" + channelNumber );
136136 channelNumberAllocator .free (channelNumber );
137137 }
138138}
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ public void broadcastShutdownSignal(ShutdownSignalException signal) {
166166 }
167167
168168 public void releaseChannelNumber () {
169- _connection .disconnectChannel (_channelNumber );
169+ _connection .disconnectChannel (this );
170170 }
171171
172172 /**
You can’t perform that action at this time.
0 commit comments