Class: PhusionPassenger::AnalyticsLogger::SharedData

Inherits:
Object
  • Object
show all
Defined in:
lib/phusion_passenger/analytics_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSharedData

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

#clientObject

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

#refObject



277
278
279
# File 'lib/phusion_passenger/analytics_logger.rb', line 277

def ref
	@refcount += 1
end

#synchronizeObject



288
289
290
291
292
# File 'lib/phusion_passenger/analytics_logger.rb', line 288

def synchronize
	@mutex.synchronize do
		yield
	end
end

#unrefObject



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