Module XRay::ThreadAwareDispatcher
In: lib/xray/thread_aware_dispatcher.rb

Methods

included  

Public Class methods

Intercept dispatch with our own method when the module is included.

[Source]

    # File lib/xray/thread_aware_dispatcher.rb, line 6
 6:     def self.included(target)
 7:       class << target
 8:         attr_reader :thread_in_dispatch
 9: 
10:         alias actual_dispatch dispatch
11:   
12:         # Capture as an instance variable the current 
13:         # thread -- which is processing current Rails request --
14:         # and do the actual dispatch. 
15:         def dispatch(*args)
16:           @thread_in_dispatch = Thread.current
17:           actual_dispatch *args
18:         ensure
19:           @thread_in_dispatch = nil
20:         end
21:   
22:       end
23:     end

[Validate]