Class: Async::WebDriver::Bridge::Pool::BridgeController
- Inherits:
-
Object
- Object
- Async::WebDriver::Bridge::Pool::BridgeController
- Defined in:
- lib/async/webdriver/bridge/pool.rb
Overview
Controls pooled drivers and cached sessions.
Defined Under Namespace
Classes: SessionCache
Instance Method Summary collapse
-
#acquire ⇒ Object
Acquire a session payload from the pool.
-
#call ⇒ Object
Constructor for the pool.
-
#close ⇒ Object
Close the underlying driver pool.
-
#initialize(bridge, capabilities: bridge.default_capabilities) ⇒ BridgeController
constructor
Initialize the bridge controller.
-
#release(session) ⇒ Object
Return a session payload to the pool.
-
#retire(session) ⇒ Object
Retire a session payload and its cache from the pool.
Constructor Details
#initialize(bridge, capabilities: bridge.default_capabilities) ⇒ BridgeController
Initialize the bridge controller.
32 33 34 35 36 |
# File 'lib/async/webdriver/bridge/pool.rb', line 32 def initialize(bridge, capabilities: bridge.default_capabilities) @bridge = bridge @capabilities = capabilities @pool = Async::Pool::Controller.new(self) end |
Instance Method Details
#acquire ⇒ Object
Acquire a session payload from the pool.
116 117 118 119 120 |
# File 'lib/async/webdriver/bridge/pool.rb', line 116 def acquire session_cache = @pool.acquire return session_cache.acquire end |
#call ⇒ Object
Constructor for the pool.
110 111 112 |
# File 'lib/async/webdriver/bridge/pool.rb', line 110 def call SessionCache.new(@bridge.start, @capabilities) end |
#close ⇒ Object
Close the underlying driver pool.
143 144 145 146 147 148 |
# File 'lib/async/webdriver/bridge/pool.rb', line 143 def close if @pool @pool.close @pool = nil end end |
#release(session) ⇒ Object
Return a session payload to the pool.
124 125 126 127 128 129 130 |
# File 'lib/async/webdriver/bridge/pool.rb', line 124 def release(session) session_cache = session[:cache] session_cache.release(session) @pool.release(session_cache) end |
#retire(session) ⇒ Object
Retire a session payload and its cache from the pool.
134 135 136 137 138 139 140 |
# File 'lib/async/webdriver/bridge/pool.rb', line 134 def retire(session) session_cache = session[:cache] session_cache.release(session) @pool.retire(session_cache) end |