logstash-core 5.3.3-java → 5.4.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gemspec_jars.rb +2 -0
- data/lib/logstash-core/logstash-core.jar +0 -0
- data/lib/logstash-core/version.rb +1 -1
- data/lib/logstash-core_jars.rb +4 -0
- data/lib/logstash/agent.rb +15 -6
- data/lib/logstash/api/modules/base.rb +1 -1
- data/lib/logstash/api/rack_app.rb +1 -1
- data/lib/logstash/config/config_ast.rb +13 -13
- data/lib/logstash/config/mixin.rb +33 -28
- data/lib/logstash/environment.rb +11 -0
- data/lib/logstash/event.rb +56 -0
- data/lib/logstash/event_dispatcher.rb +2 -2
- data/lib/logstash/execution_context.rb +10 -0
- data/lib/logstash/filter_delegator.rb +3 -2
- data/lib/logstash/inputs/base.rb +15 -1
- data/lib/logstash/instrument/collector.rb +1 -1
- data/lib/logstash/instrument/metric.rb +4 -2
- data/lib/logstash/instrument/metric_store.rb +9 -5
- data/lib/logstash/instrument/null_metric.rb +1 -0
- data/lib/logstash/instrument/periodic_poller/cgroup.rb +3 -3
- data/lib/logstash/instrument/periodic_poller/jvm.rb +11 -8
- data/lib/logstash/instrument/periodic_poller/load_average.rb +4 -2
- data/lib/logstash/instrument/wrapped_write_client.rb +59 -0
- data/lib/logstash/java_integration.rb +2 -2
- data/lib/logstash/output_delegator.rb +2 -2
- data/lib/logstash/output_delegator_strategies/legacy.rb +5 -2
- data/lib/logstash/output_delegator_strategies/shared.rb +2 -1
- data/lib/logstash/output_delegator_strategies/single.rb +2 -1
- data/lib/logstash/outputs/base.rb +8 -0
- data/lib/logstash/patches/cabin.rb +1 -1
- data/lib/logstash/patches/stronger_openssl_defaults.rb +1 -1
- data/lib/logstash/pipeline.rb +47 -19
- data/lib/logstash/plugin.rb +3 -1
- data/lib/logstash/plugins/hooks_registry.rb +6 -6
- data/lib/logstash/plugins/registry.rb +2 -2
- data/lib/logstash/queue_factory.rb +7 -5
- data/lib/logstash/runner.rb +15 -1
- data/lib/logstash/settings.rb +14 -2
- data/lib/logstash/string_interpolation.rb +18 -0
- data/lib/logstash/timestamp.rb +27 -0
- data/lib/logstash/util.rb +1 -1
- data/lib/logstash/util/prctl.rb +1 -1
- data/lib/logstash/util/retryable.rb +1 -1
- data/lib/logstash/util/wrapped_acked_queue.rb +53 -22
- data/lib/logstash/util/wrapped_synchronous_queue.rb +51 -33
- data/lib/logstash/version.rb +1 -1
- data/locales/en.yml +4 -2
- data/logstash-core.gemspec +0 -3
- data/spec/api/lib/api/node_stats_spec.rb +2 -1
- data/spec/api/spec_helper.rb +1 -1
- data/spec/logstash/acked_queue_concurrent_stress_spec.rb +291 -0
- data/spec/logstash/agent_spec.rb +24 -0
- data/spec/logstash/config/mixin_spec.rb +11 -2
- data/spec/logstash/event_dispatcher_spec.rb +8 -1
- data/spec/logstash/event_spec.rb +346 -0
- data/spec/logstash/execution_context_spec.rb +13 -0
- data/spec/logstash/filter_delegator_spec.rb +4 -2
- data/spec/logstash/inputs/base_spec.rb +41 -0
- data/spec/logstash/instrument/metric_spec.rb +2 -1
- data/spec/logstash/instrument/metric_store_spec.rb +14 -0
- data/spec/logstash/instrument/namespaced_metric_spec.rb +2 -1
- data/spec/logstash/instrument/periodic_poller/cgroup_spec.rb +1 -1
- data/spec/logstash/instrument/periodic_poller/jvm_spec.rb +35 -0
- data/spec/logstash/instrument/periodic_poller/load_average_spec.rb +1 -5
- data/spec/logstash/instrument/wrapped_write_client_spec.rb +113 -0
- data/spec/logstash/json_spec.rb +1 -1
- data/spec/logstash/legacy_ruby_event_spec.rb +636 -0
- data/spec/logstash/legacy_ruby_timestamp_spec.rb +170 -0
- data/spec/logstash/output_delegator_spec.rb +6 -3
- data/spec/logstash/outputs/base_spec.rb +23 -0
- data/spec/logstash/pipeline_pq_file_spec.rb +18 -8
- data/spec/logstash/pipeline_spec.rb +41 -5
- data/spec/logstash/plugin_spec.rb +15 -3
- data/spec/logstash/plugins/hooks_registry_spec.rb +2 -2
- data/spec/logstash/runner_spec.rb +33 -2
- data/spec/logstash/settings/port_range_spec.rb +1 -1
- data/spec/logstash/settings_spec.rb +21 -0
- data/spec/logstash/timestamp_spec.rb +29 -0
- data/spec/logstash/util/accessors_spec.rb +179 -0
- data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +4 -11
- data/spec/logstash/util_spec.rb +1 -1
- data/spec/logstash/webserver_spec.rb +1 -1
- data/spec/support/mocks_classes.rb +65 -53
- metadata +25 -30
@@ -87,6 +87,27 @@ describe LogStash::Settings do
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
|
+
|
91
|
+
describe "post_process" do
|
92
|
+
subject(:settings) { described_class.new }
|
93
|
+
|
94
|
+
before do
|
95
|
+
settings.on_post_process do
|
96
|
+
settings.set("baz", "bot")
|
97
|
+
end
|
98
|
+
settings.register(LogStash::Setting::String.new("foo", "bar"))
|
99
|
+
settings.register(LogStash::Setting::String.new("baz", "somedefault"))
|
100
|
+
settings.post_process
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should run the post process callbacks" do
|
104
|
+
expect(settings.get("baz")).to eq("bot")
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should preserve original settings" do
|
108
|
+
expect(settings.get("foo")).to eq("bar")
|
109
|
+
end
|
110
|
+
end
|
90
111
|
|
91
112
|
context "transient settings" do
|
92
113
|
subject do
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
require "logstash/timestamp"
|
5
|
+
|
6
|
+
describe LogStash::Timestamp do
|
7
|
+
context "constructors" do
|
8
|
+
it "should work" do
|
9
|
+
t = LogStash::Timestamp.new
|
10
|
+
expect(t.time.to_i).to be_within(1).of Time.now.to_i
|
11
|
+
|
12
|
+
t = LogStash::Timestamp.now
|
13
|
+
expect(t.time.to_i).to be_within(1).of Time.now.to_i
|
14
|
+
|
15
|
+
now = Time.now.utc
|
16
|
+
t = LogStash::Timestamp.new(now)
|
17
|
+
expect(t.time).to eq(now)
|
18
|
+
|
19
|
+
t = LogStash::Timestamp.at(now.to_i)
|
20
|
+
expect(t.time.to_i).to eq(now.to_i)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should raise exception on invalid format" do
|
24
|
+
expect{LogStash::Timestamp.new("foobar")}.to raise_error
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
# this is to skip specs when running agains an alternate logstash-core-event implementation
|
5
|
+
# that does not define the Accessors class. For example, in logstash-core-event-java
|
6
|
+
# the Accessors class does not exists in the Ruby namespace.
|
7
|
+
class_exists = begin
|
8
|
+
require "logstash/util/accessors"
|
9
|
+
true
|
10
|
+
rescue LoadError
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "LogStash::Util::Accessors", :if => class_exists do
|
15
|
+
|
16
|
+
context "using simple field" do
|
17
|
+
|
18
|
+
it "should get value of word key" do
|
19
|
+
str = "hello"
|
20
|
+
data = { "hello" => "world" }
|
21
|
+
accessors = LogStash::Util::Accessors.new(data)
|
22
|
+
expect(accessors.get(str)).to eq(data[str])
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should get value of key with spaces" do
|
26
|
+
str = "hel lo"
|
27
|
+
data = { "hel lo" => "world" }
|
28
|
+
accessors = LogStash::Util::Accessors.new(data)
|
29
|
+
expect(accessors.get(str)).to eq(data[str])
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should get value of numeric key string" do
|
33
|
+
str = "1"
|
34
|
+
data = { "1" => "world" }
|
35
|
+
accessors = LogStash::Util::Accessors.new(data)
|
36
|
+
expect(accessors.get(str)).to eq(data[str])
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should handle delete" do
|
40
|
+
str = "simple"
|
41
|
+
data = { "simple" => "things" }
|
42
|
+
accessors = LogStash::Util::Accessors.new(data)
|
43
|
+
expect(accessors.del(str)).to eq("things")
|
44
|
+
expect(data).to be_empty
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should handle delete on non-existent field" do
|
48
|
+
str = "[foo][bar]"
|
49
|
+
data = { "hello" => "world" }
|
50
|
+
accessors = LogStash::Util::Accessors.new(data)
|
51
|
+
expect(accessors.del(str)).to be_nil
|
52
|
+
expect(data).not_to be_empty
|
53
|
+
# assert no side effects
|
54
|
+
expect(accessors.get("foo")).to be_nil
|
55
|
+
expect(accessors.get("hello")).to eq("world")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should set string value" do
|
59
|
+
str = "simple"
|
60
|
+
data = {}
|
61
|
+
accessors = LogStash::Util::Accessors.new(data)
|
62
|
+
expect(accessors.set(str, "things")).to eq("things")
|
63
|
+
expect(data).to eq({ "simple" => "things" })
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should set array value" do
|
67
|
+
str = "simple"
|
68
|
+
data = {}
|
69
|
+
accessors = LogStash::Util::Accessors.new(data)
|
70
|
+
expect(accessors.set(str, ["foo", "bar"])).to eq(["foo", "bar"])
|
71
|
+
expect(data).to eq({ "simple" => ["foo", "bar"]})
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "using field path" do
|
76
|
+
|
77
|
+
it "should get shallow string value of word key" do
|
78
|
+
str = "[hello]"
|
79
|
+
data = { "hello" => "world" }
|
80
|
+
accessors = LogStash::Util::Accessors.new(data)
|
81
|
+
expect(accessors.get(str)).to eq("world")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should get shallow string value of key with spaces" do
|
85
|
+
str = "[hel lo]"
|
86
|
+
data = { "hel lo" => "world" }
|
87
|
+
accessors = LogStash::Util::Accessors.new(data)
|
88
|
+
expect(accessors.get(str)).to eq("world")
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should get shallow string value of numeric key string" do
|
92
|
+
str = "[1]"
|
93
|
+
data = { "1" => "world" }
|
94
|
+
accessors = LogStash::Util::Accessors.new(data)
|
95
|
+
expect(accessors.get(str)).to eq("world")
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should get deep string value" do
|
99
|
+
str = "[hello][world]"
|
100
|
+
data = { "hello" => { "world" => "foo", "bar" => "baz" } }
|
101
|
+
accessors = LogStash::Util::Accessors.new(data)
|
102
|
+
expect(accessors.get(str)).to eq(data["hello"]["world"])
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should return nil when getting a non-existant field (with no side-effects on original data)" do
|
106
|
+
str = "[hello][world]"
|
107
|
+
data = {}
|
108
|
+
accessors = LogStash::Util::Accessors.new(data)
|
109
|
+
expect(accessors.get(str)).to be_nil
|
110
|
+
expect(data).to be_empty
|
111
|
+
expect(accessors.set(str, "foo")).to eq("foo")
|
112
|
+
expect(data).to eq({ "hello" => {"world" => "foo"} })
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should handle delete" do
|
116
|
+
str = "[hello][world]"
|
117
|
+
data = { "hello" => { "world" => "foo", "bar" => "baz" } }
|
118
|
+
accessors = LogStash::Util::Accessors.new(data)
|
119
|
+
expect(accessors.del(str)).to eq("foo")
|
120
|
+
|
121
|
+
# Make sure the "world" key is removed.
|
122
|
+
expect(data["hello"]).to eq({ "bar" => "baz" })
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should set shallow string value" do
|
126
|
+
str = "[hello]"
|
127
|
+
data = {}
|
128
|
+
accessors = LogStash::Util::Accessors.new(data)
|
129
|
+
expect(accessors.set(str, "foo")).to eq("foo")
|
130
|
+
expect(data).to eq({ "hello" => "foo" })
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should set deep string value" do
|
134
|
+
str = "[hello][world]"
|
135
|
+
data = {}
|
136
|
+
accessors = LogStash::Util::Accessors.new(data)
|
137
|
+
expect(accessors.set(str, "foo")).to eq("foo")
|
138
|
+
expect(data).to eq({ "hello" => { "world" => "foo" } })
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should set deep array value" do
|
142
|
+
str = "[hello][world]"
|
143
|
+
data = {}
|
144
|
+
accessors = LogStash::Util::Accessors.new(data)
|
145
|
+
expect(accessors.set(str, ["foo", "bar"])).to eq(["foo", "bar"])
|
146
|
+
expect(data).to eq({ "hello" => { "world" => ["foo", "bar"] } })
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should set element within array value" do
|
150
|
+
str = "[hello][0]"
|
151
|
+
data = {"hello" => ["foo", "bar"]}
|
152
|
+
accessors = LogStash::Util::Accessors.new(data)
|
153
|
+
expect(accessors.set(str, "world") ).to eq("world")
|
154
|
+
expect(data).to eq({"hello" => ["world", "bar"]})
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should retrieve array item" do
|
158
|
+
data = { "hello" => { "world" => ["a", "b"], "bar" => "baz" } }
|
159
|
+
accessors = LogStash::Util::Accessors.new(data)
|
160
|
+
expect(accessors.get("[hello][world][0]")).to eq(data["hello"]["world"][0])
|
161
|
+
expect(accessors.get("[hello][world][1]")).to eq(data["hello"]["world"][1])
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should retrieve array item containing hash" do
|
165
|
+
data = { "hello" => { "world" => [ { "a" => 123 }, { "b" => 345 } ], "bar" => "baz" } }
|
166
|
+
accessors = LogStash::Util::Accessors.new(data)
|
167
|
+
expect(accessors.get("[hello][world][0][a]")).to eq(data["hello"]["world"][0]["a"])
|
168
|
+
expect(accessors.get("[hello][world][1][b]")).to eq(data["hello"]["world"][1]["b"])
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should handle delete of array element" do
|
172
|
+
str = "[geocoords][0]"
|
173
|
+
data = { "geocoords" => [4, 2] }
|
174
|
+
accessors = LogStash::Util::Accessors.new(data)
|
175
|
+
expect(accessors.del(str)).to eq(4)
|
176
|
+
expect(data).to eq({ "geocoords" => [2] })
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -60,13 +60,10 @@ describe LogStash::Util::WrappedSynchronousQueue do
|
|
60
60
|
|
61
61
|
context "when the queue is empty" do
|
62
62
|
it "doesnt record the `duration_in_millis`" do
|
63
|
-
batch = read_client.
|
63
|
+
batch = read_client.read_batch
|
64
64
|
read_client.close_batch(batch)
|
65
65
|
store = collector.snapshot_metric.metric_store
|
66
66
|
|
67
|
-
expect(store.get_shallow(:events, :in).value).to eq(0)
|
68
|
-
expect(store.get_shallow(:events, :in)).to be_kind_of(LogStash::Instrument::MetricType::Counter)
|
69
|
-
|
70
67
|
expect(store.get_shallow(:events, :out).value).to eq(0)
|
71
68
|
expect(store.get_shallow(:events, :out)).to be_kind_of(LogStash::Instrument::MetricType::Counter)
|
72
69
|
|
@@ -76,9 +73,6 @@ describe LogStash::Util::WrappedSynchronousQueue do
|
|
76
73
|
expect(store.get_shallow(:events, :duration_in_millis).value).to eq(0)
|
77
74
|
expect(store.get_shallow(:events, :duration_in_millis)).to be_kind_of(LogStash::Instrument::MetricType::Counter)
|
78
75
|
|
79
|
-
expect(store.get_shallow(:pipeline, :in).value).to eq(0)
|
80
|
-
expect(store.get_shallow(:pipeline, :in)).to be_kind_of(LogStash::Instrument::MetricType::Counter)
|
81
|
-
|
82
76
|
expect(store.get_shallow(:pipeline, :duration_in_millis).value).to eq(0)
|
83
77
|
expect(store.get_shallow(:pipeline, :duration_in_millis)).to be_kind_of(LogStash::Instrument::MetricType::Counter)
|
84
78
|
|
@@ -95,7 +89,8 @@ describe LogStash::Util::WrappedSynchronousQueue do
|
|
95
89
|
batch = write_client.get_new_batch
|
96
90
|
5.times {|i| batch.push("value-#{i}")}
|
97
91
|
write_client.push_batch(batch)
|
98
|
-
|
92
|
+
|
93
|
+
read_batch = read_client.read_batch
|
99
94
|
sleep(0.1) # simulate some work for the `duration_in_millis`
|
100
95
|
# TODO: this interaction should be cleaned in an upcoming PR,
|
101
96
|
# This is what the current pipeline does.
|
@@ -104,11 +99,9 @@ describe LogStash::Util::WrappedSynchronousQueue do
|
|
104
99
|
read_client.close_batch(read_batch)
|
105
100
|
store = collector.snapshot_metric.metric_store
|
106
101
|
|
107
|
-
expect(store.get_shallow(:events, :in).value).to eq(5)
|
108
102
|
expect(store.get_shallow(:events, :out).value).to eq(5)
|
109
103
|
expect(store.get_shallow(:events, :filtered).value).to eq(5)
|
110
104
|
expect(store.get_shallow(:events, :duration_in_millis).value).to be > 0
|
111
|
-
expect(store.get_shallow(:pipeline, :in).value).to eq(5)
|
112
105
|
expect(store.get_shallow(:pipeline, :duration_in_millis).value).to be > 0
|
113
106
|
expect(store.get_shallow(:pipeline, :out).value).to eq(5)
|
114
107
|
expect(store.get_shallow(:pipeline, :filtered).value).to eq(5)
|
@@ -126,7 +119,7 @@ describe LogStash::Util::WrappedSynchronousQueue do
|
|
126
119
|
batch = write_client.get_new_batch
|
127
120
|
5.times {|i| batch.push(LogStash::Event.new({"message" => "value-#{i}"}))}
|
128
121
|
write_client.push_batch(batch)
|
129
|
-
read_batch = read_client.
|
122
|
+
read_batch = read_client.read_batch
|
130
123
|
expect(read_batch.size).to eq(5)
|
131
124
|
i = 0
|
132
125
|
read_batch.each do |data|
|
data/spec/logstash/util_spec.rb
CHANGED
@@ -37,7 +37,7 @@ describe LogStash::Util do
|
|
37
37
|
expect(LogStash::Util.stringify_symbols([1, :a])).to eq([1, "a"])
|
38
38
|
end
|
39
39
|
|
40
|
-
it "should convert
|
40
|
+
it "should convert inner array symbol values to strings" do
|
41
41
|
expect(LogStash::Util.stringify_symbols({:a => [1, :b]})).to eq({"a" => [1, "b"]})
|
42
42
|
expect(LogStash::Util.stringify_symbols([:a, [1, :b]])).to eq(["a", [1, "b"]])
|
43
43
|
end
|
@@ -1,79 +1,91 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/outputs/base"
|
3
|
+
require "logstash/inputs/base"
|
3
4
|
require "thread"
|
4
5
|
|
5
|
-
module LogStash
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
module LogStash
|
7
|
+
module Inputs
|
8
|
+
class DummyInput < LogStash::Inputs::Base
|
9
|
+
config_name "dummyinput"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
super
|
14
|
-
@num_closes = 0
|
15
|
-
@events = []
|
11
|
+
def run(queue)
|
12
|
+
# noop
|
13
|
+
end
|
16
14
|
end
|
15
|
+
end
|
16
|
+
module Outputs
|
17
|
+
class DummyOutput < LogStash::Outputs::Base
|
18
|
+
config_name "dummyoutput"
|
19
|
+
milestone 2
|
17
20
|
|
18
|
-
|
19
|
-
end
|
21
|
+
attr_reader :num_closes, :events
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
def initialize(params={})
|
24
|
+
super
|
25
|
+
@num_closes = 0
|
26
|
+
@events = []
|
27
|
+
end
|
24
28
|
|
25
|
-
|
26
|
-
|
29
|
+
def register
|
30
|
+
end
|
31
|
+
|
32
|
+
def receive(event)
|
33
|
+
@events << event
|
34
|
+
end
|
35
|
+
|
36
|
+
def close
|
37
|
+
@num_closes += 1
|
38
|
+
end
|
27
39
|
end
|
28
|
-
end
|
29
40
|
|
30
|
-
|
31
|
-
|
32
|
-
|
41
|
+
class DummyOutputWithEventsArray < LogStash::Outputs::Base
|
42
|
+
config_name "dummyoutput2"
|
43
|
+
milestone 2
|
33
44
|
|
34
|
-
|
45
|
+
attr_reader :events
|
35
46
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
47
|
+
def initialize(params={})
|
48
|
+
super
|
49
|
+
@events = []
|
50
|
+
end
|
40
51
|
|
41
|
-
|
42
|
-
|
52
|
+
def register
|
53
|
+
end
|
43
54
|
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
def receive(event)
|
56
|
+
@events << event
|
57
|
+
end
|
47
58
|
|
48
|
-
|
59
|
+
def close
|
60
|
+
end
|
49
61
|
end
|
50
|
-
end
|
51
62
|
|
52
|
-
|
53
|
-
|
54
|
-
|
63
|
+
class DroppingDummyOutput < LogStash::Outputs::Base
|
64
|
+
config_name "droppingdummyoutput"
|
65
|
+
milestone 2
|
55
66
|
|
56
|
-
|
67
|
+
attr_reader :num_closes
|
57
68
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
69
|
+
def initialize(params={})
|
70
|
+
super
|
71
|
+
@num_closes = 0
|
72
|
+
@events_received = Concurrent::AtomicFixnum.new(0)
|
73
|
+
end
|
63
74
|
|
64
|
-
|
65
|
-
|
75
|
+
def register
|
76
|
+
end
|
66
77
|
|
67
|
-
|
68
|
-
|
69
|
-
|
78
|
+
def receive(event)
|
79
|
+
@events_received.increment
|
80
|
+
end
|
70
81
|
|
71
|
-
|
72
|
-
|
73
|
-
|
82
|
+
def events_received
|
83
|
+
@events_received.value
|
84
|
+
end
|
74
85
|
|
75
|
-
|
76
|
-
|
86
|
+
def close
|
87
|
+
@num_closes = 1
|
88
|
+
end
|
77
89
|
end
|
78
90
|
end
|
79
|
-
end
|
91
|
+
end
|