module Sequel::ArbitraryServers
def acquire(thread, server)
If server is a hash, create a new connection for
def acquire(thread, server) if server.is_a?(Hash) sync{@allocated[thread] ||= {}}[server] = make_new(server) else super end end
def owned_connection(thread, server)
exist in the @allocated hash, so check for existence to
If server is a hash, the entry for it probably doesn't
def owned_connection(thread, server) if server.is_a?(Hash) if a = sync{@allocated[thread]} a[server] end else super end end
def pick_server(server)
def pick_server(server) if server.is_a?(Hash) server else super end end
def release(thread, conn, server)
connections for that server. Additionally, if this was the last thread
If server is a hash, delete the thread from the allocated
def release(thread, conn, server) if server.is_a?(Hash) a = @allocated[thread] a.delete(server) @allocated.delete(thread) if a.empty? @disconnection_proc.call(conn) if @disconnection_proc else super end end