lib/em-synchrony/connection_pool.rb in em-synchrony-1.0.0 vs lib/em-synchrony/connection_pool.rb in em-synchrony-1.0.1
- old
+ new
@@ -1,9 +1,11 @@
module EventMachine
module Synchrony
class ConnectionPool
+ undef :send
+
def initialize(opts, &block)
@reserved = {} # map of in-progress connections
@available = [] # pool of free connections
@pending = [] # pending reservations (FIFO)
@@ -30,11 +32,10 @@
# Acquire a lock on a connection and assign it to executing fiber
# - if connection is available, pass it back to the calling block
# - if pool is full, yield the current fiber until connection is available
def acquire(fiber)
-
if conn = @available.pop
@reserved[fiber.object_id] = conn
conn
else
Fiber.yield @pending.push fiber
@@ -64,10 +65,10 @@
#
def method_missing(method, *args, &blk)
async = (method[0,1] == "a")
execute(async) do |conn|
- df = conn.send(method, *args, &blk)
+ df = conn.__send__(method, *args, &blk)
if async
fiber = Fiber.current
df.callback { release(fiber) }
df.errback { release(fiber) }