Class: PhusionPassenger::AnalyticsLogger::SharedData
- Defined in:
- lib/phusion_passenger/analytics_logger.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #disconnect(check_error_response = false) ⇒ Object
-
#initialize ⇒ SharedData
constructor
A new instance of SharedData.
- #ref ⇒ Object
- #synchronize ⇒ Object
- #unref ⇒ Object
Constructor Details
#initialize ⇒ SharedData
Returns a new instance of SharedData.
267 268 269 270 |
# File 'lib/phusion_passenger/analytics_logger.rb', line 267 def initialize @mutex = Mutex.new @refcount = 1 end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
265 266 267 |
# File 'lib/phusion_passenger/analytics_logger.rb', line 265 def client @client end |
Instance Method Details
#disconnect(check_error_response = false) ⇒ Object
272 273 274 275 |
# File 'lib/phusion_passenger/analytics_logger.rb', line 272 def disconnect(check_error_response = false) # TODO: implement check_error_response support @client.close if @client end |
#ref ⇒ Object
277 278 279 |
# File 'lib/phusion_passenger/analytics_logger.rb', line 277 def ref @refcount += 1 end |
#synchronize ⇒ Object
288 289 290 291 292 |
# File 'lib/phusion_passenger/analytics_logger.rb', line 288 def synchronize @mutex.synchronize do yield end end |
#unref ⇒ Object
281 282 283 284 285 286 |
# File 'lib/phusion_passenger/analytics_logger.rb', line 281 def unref @refcount -= 1 if @refcount == 0 disconnect end end |