com.rabbitmq.client.impl
Class ChannelManager

java.lang.Object
  extended by com.rabbitmq.client.impl.ChannelManager

public final class ChannelManager
extends java.lang.Object

Manages a set of channels, indexed by channel number (1.._channelMax).


Constructor Summary
ChannelManager(com.rabbitmq.client.impl.ConsumerWorkService workService, int channelMax)
           
 
Method Summary
 ChannelN createChannel(AMQConnection connection)
           
 ChannelN createChannel(AMQConnection connection, int channelNumber)
           
 ChannelN getChannel(int channelNumber)
          Looks up a channel on this connection.
 int getChannelMax()
           
 void handleSignal(ShutdownSignalException signal)
          Handle shutdown.
 void releaseChannelNumber(ChannelN channel)
          Remove the channel from the channel map and free the number for re-use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelManager

public ChannelManager(com.rabbitmq.client.impl.ConsumerWorkService workService,
                      int channelMax)
Method Detail

getChannelMax

public int getChannelMax()

getChannel

public ChannelN getChannel(int channelNumber)
Looks up a channel on this connection.

Parameters:
channelNumber - the number of the required channel
Returns:
the channel on this connection with number channelNumber
Throws:
UnknownChannelException - if there is no channel with number channelNumber on this connection

handleSignal

public void handleSignal(ShutdownSignalException signal)
Handle shutdown. All the managed Channels are shutdown.

Parameters:
signal - reason for shutdown

createChannel

public ChannelN createChannel(AMQConnection connection)
                       throws java.io.IOException
Throws:
java.io.IOException

createChannel

public ChannelN createChannel(AMQConnection connection,
                              int channelNumber)
                       throws java.io.IOException
Throws:
java.io.IOException

releaseChannelNumber

public void releaseChannelNumber(ChannelN channel)
Remove the channel from the channel map and free the number for re-use. This method must be safe to call multiple times on the same channel. If it is not then things go badly wrong.