Class: HTTP::Session::PoolManager
- Inherits:
-
Object
- Object
- HTTP::Session::PoolManager
- Includes:
- MonitorMixin
- Defined in:
- lib/http/session/pool_manager.rb
Instance Method Summary collapse
-
#initialize(options, session) ⇒ PoolManager
constructor
Returns a new instance of PoolManager.
-
#with(uri, &blk) ⇒ Object
Obtain a connection.
Constructor Details
#initialize(options, session) ⇒ PoolManager
Returns a new instance of PoolManager.
9 10 11 12 13 14 |
# File 'lib/http/session/pool_manager.rb', line 9 def initialize(, session) super() @options = @session = session @pools = {} end |
Instance Method Details
#with(uri, &blk) ⇒ Object
Obtain a connection.
17 18 19 20 21 22 23 24 |
# File 'lib/http/session/pool_manager.rb', line 17 def with(uri, &blk) return with_new_conn(&blk) unless @options.enabled? origin = HTTP::URI.parse(uri).origin return with_new_conn(&blk) unless connection_pool_usable?(origin) with_reusable_conn(origin, &blk) end |