Module: ClassLoadingWatcher::SanityCheck

Included in:
Module, Object
Defined in:
lib/new_relic/agent/patch_const_missing.rb

Overview

@@background_thread = nil

bad = ConstMissingInForegroundThread rescue nil
@@background_thread = thread
bad = ConstMissingInBackgroundThread rescue nil
require 'new_relic/agent/patch_const_missing'
load 'new_relic/agent/patch_const_missing.rb'

Instance Method Summary collapse

Instance Method Details

#nr_check_for_classloading(*args) ⇒ Object



38
39
40
41
42
43
# File 'lib/new_relic/agent/patch_const_missing.rb', line 38

def nr_check_for_classloading(*args)
  
  if Thread.current == ClassLoadingWatcher.background_thread    
    nr_error "Agent background thread shouldn't be loading classes (#{args.inspect})"  
  end
end

#nr_check_for_constmissing(*args) ⇒ Object



45
46
47
48
49
# File 'lib/new_relic/agent/patch_const_missing.rb', line 45

def nr_check_for_constmissing(*args)
  if ClassLoadingWatcher.flag_const_missing
    nr_error "Classes in Agent should not be loaded via const_missing (#{args.inspect})"        
  end
end