Class: NewRelic::Agent::StatsEngine::MetricStats::SynchronizedHash

Inherits:
Hash
  • Object
show all
Includes:
LanguageSupport::SynchronizedHash
Defined in:
lib/new_relic/agent/stats_engine/metric_stats.rb

Overview

A simple mutex-synchronized hash to make sure our statistics are internally consistent even in truly-threaded rubies like JRuby

Instance Method Summary collapse

Methods included from LanguageSupport::SynchronizedHash

included

Constructor Details

#initializeSynchronizedHash

Returns a new instance of SynchronizedHash.



13
14
15
# File 'lib/new_relic/agent/stats_engine/metric_stats.rb', line 13

def initialize
  @lock = Mutex.new
end

Instance Method Details

#[]=(*args) ⇒ Object



17
18
19
# File 'lib/new_relic/agent/stats_engine/metric_stats.rb', line 17

def []=(*args)
  @lock.synchronize { super }
end

#clear(*args) ⇒ Object



21
22
23
# File 'lib/new_relic/agent/stats_engine/metric_stats.rb', line 21

def clear(*args)
  @lock.synchronize { super }
end

#delete(*args) ⇒ Object



25
26
27
# File 'lib/new_relic/agent/stats_engine/metric_stats.rb', line 25

def delete(*args)
  @lock.synchronize { super }
end

#delete_if(*args) ⇒ Object



29
30
31
# File 'lib/new_relic/agent/stats_engine/metric_stats.rb', line 29

def delete_if(*args)
  @lock.synchronize { super }
end