# File lib/new_relic/agent/commands/xray_session_collection.rb, line 15 def initialize(backtrace_service, event_listener) @backtrace_service = backtrace_service # This lock protects access to the sessions hash, but it's expected # that individual session objects within the hash will be manipulated # outside the lock. This is safe because manipulation of the session # objects is expected from only a single thread (the harvest thread) @sessions_lock = Mutex.new @sessions = {} if event_listener event_listener.subscribe(:before_harvest, &method(:cleanup_finished_sessions)) end end