Class: Bundler::Persistent::Net::HTTP::Persistent::Pool
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
Bundler::ConnectionPool
|
Defined in: | lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb |
Constant Summary
::Bundler::ConnectionPool
- Inherited
Class Method Summary
- .new(options = {}, &block) ⇒ Pool constructor
::Bundler::ConnectionPool
- Inherited
.monotonic_time | Returns the current time a tracked by the application monotonic clock. |
.new, .wrap |
Instance Attribute Summary
- #available readonly
- #key readonly
Instance Method Summary
::Bundler::ConnectionPool
- Inherited
Constructor Details
.new(options = {}, &block) ⇒ Pool
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb', line 6
def initialize( = {}, &block) super @available = Bundler::Persistent::Net::HTTP::Persistent::TimedStackMulti.new(@size, &block) @key = "current-#{@available.object_id}" end
Instance Attribute Details
#available (readonly)
[ GitHub ]# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb', line 3
attr_reader :available # :nodoc:
#key (readonly)
[ GitHub ]# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb', line 4
attr_reader :key # :nodoc:
Instance Method Details
#checkin(net_http_args)
# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb', line 13
def checkin net_http_args stack = Thread.current[@key][net_http_args] ||= [] raise Bundler::ConnectionPool::Error, 'no connections are checked out' if stack.empty? conn = stack.pop if stack.empty? @available.push conn, connection_args: net_http_args Thread.current[@key].delete(net_http_args) Thread.current[@key] = nil if Thread.current[@key].empty? end nil end
#checkout(net_http_args)
[ GitHub ]# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb', line 31
def checkout net_http_args stacks = Thread.current[@key] ||= {} stack = stacks[net_http_args] ||= [] if stack.empty? then conn = @available.pop connection_args: net_http_args else conn = stack.last end stack.push conn conn end
#shutdown
[ GitHub ]# File 'lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb', line 46
def shutdown Thread.current[@key] = nil super end