Class: Fwd::Pool
Overview
“Clone” of normal ConnectionPool but tweaked for round-robin
Defined Under Namespace
Classes: IdleStack
Instance Method Summary collapse
- #checkout ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(items) ⇒ Pool
constructor
A new instance of Pool.
Constructor Details
Instance Method Details
#checkout ⇒ Object
28 29 30 31 32 33 |
# File 'lib/fwd/pool.rb', line 28 def checkout conn = @idle.pop(30) yield conn ensure @idle.unshift(conn) if conn end |
#each(&block) ⇒ Object
24 25 26 |
# File 'lib/fwd/pool.rb', line 24 def each(&block) @size.times { checkout(&block) } end |