class MessagePack::Factory::Pool
def dump(object)
def dump(object) packer = @packers.checkout begin packer.write(object) packer.full_pack ensure @packers.checkin(packer) end end
def initialize(factory, size, options = nil)
def initialize(factory, size, options = nil) options = nil if !options || options.empty? @factory = factory @packers = PackerPool.new(size) { factory.packer(options) } @unpackers = UnpackerPool.new(size) { factory.unpacker(options) } end
def load(data)
def load(data) unpacker = @unpackers.checkout begin unpacker.feed_reference(data) unpacker.full_unpack ensure @unpackers.checkin(unpacker) end end