lib/bunny/channel_id_allocator.rb in bunny-0.9.0.pre13 vs lib/bunny/channel_id_allocator.rb in bunny-0.9.0.rc1
- old
+ new
@@ -1,9 +1,16 @@
require "thread"
require "amq/int_allocator"
module Bunny
+ # Bitset-based channel id allocator. When channels are closed,
+ # ids are released back to the pool.
+ #
+ # Every connection has its own allocator.
+ #
+ # Allocating and releasing ids is synchronized and can be performed
+ # from multiple threads.
class ChannelIdAllocator
#
# API
#
@@ -62,9 +69,10 @@
@mutex.synchronize do
@allocator.reset
end
end
+ # @private
def synchronize(&block)
@mutex.synchronize(&block)
end
end
end