# File lib/ftw/pool.rb, line 41 def fetch(identifier, &default_block) @lock.synchronize do @pool[identifier].delete_if { |o| o.available? && !o.connected? } object = @pool[identifier].find { |o| o.available? } return object if !object.nil? end # Otherwise put the return value of default_block in the # pool and return it, but don't put nil values in the pool. obj = default_block.call if obj.nil? return nil else return add(identifier, obj) end end