Class: Jaeger::Reporters::RemoteReporter::Buffer
- Inherits:
-
Object
- Object
- Jaeger::Reporters::RemoteReporter::Buffer
- Defined in:
- lib/jaeger/reporters/remote_reporter/buffer.rb
Instance Method Summary collapse
- #<<(element) ⇒ Object
-
#initialize ⇒ Buffer
constructor
A new instance of Buffer.
- #retrieve ⇒ Object
Constructor Details
#initialize ⇒ Buffer
Returns a new instance of Buffer.
7 8 9 10 |
# File 'lib/jaeger/reporters/remote_reporter/buffer.rb', line 7 def initialize @buffer = [] @mutex = Mutex.new end |
Instance Method Details
#<<(element) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/jaeger/reporters/remote_reporter/buffer.rb', line 12 def <<(element) @mutex.synchronize do @buffer << element true end end |
#retrieve ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/jaeger/reporters/remote_reporter/buffer.rb', line 19 def retrieve @mutex.synchronize do elements = @buffer.dup @buffer.clear elements end end |