logstash-output-kusto 1.0.6-java → 2.0.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -37
- data/CONTRIBUTORS +10 -10
- data/Gemfile +11 -22
- data/LICENSE +201 -201
- data/README.md +103 -94
- data/SECURITY.md +41 -41
- data/lib/logstash/outputs/kusto/ingestor.rb +166 -138
- data/lib/logstash/outputs/kusto/interval.rb +81 -81
- data/lib/logstash/outputs/kusto.rb +424 -422
- data/lib/logstash-output-kusto_jars.rb +72 -149
- data/logstash-output-kusto.gemspec +35 -36
- data/spec/outputs/kusto/ingestor_spec.rb +131 -121
- data/spec/outputs/kusto_spec.rb +56 -56
- data/spec/spec_helpers.rb +21 -21
- data/vendor/jar-dependencies/com/azure/azure-core/1.41.0/azure-core-1.41.0.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-core-http-netty/1.13.5/azure-core-http-netty-1.13.5.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-data-tables/12.3.13/azure-data-tables-12.3.13.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-identity/1.9.2/azure-identity-1.9.2.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-json/1.0.1/azure-json-1.0.1.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-storage-blob/12.23.0/azure-storage-blob-12.23.0.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-storage-common/12.22.0/azure-storage-common-12.22.0.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-storage-internal-avro/12.8.0/azure-storage-internal-avro-12.8.0.jar +0 -0
- data/vendor/jar-dependencies/com/azure/azure-storage-queue/12.18.0/azure-storage-queue-12.18.0.jar +0 -0
- data/{lib/com/fasterxml/jackson/core/jackson-annotations/2.12.5/jackson-annotations-2.12.5.jar → vendor/jar-dependencies/com/fasterxml/jackson/core/jackson-annotations/2.14.2/jackson-annotations-2.14.2.jar} +0 -0
- data/vendor/jar-dependencies/com/fasterxml/jackson/core/jackson-core/2.14.2/jackson-core-2.14.2.jar +0 -0
- data/{lib/com/fasterxml/jackson/core/jackson-databind/2.13.0/jackson-databind-2.13.0.jar → vendor/jar-dependencies/com/fasterxml/jackson/core/jackson-databind/2.14.2/jackson-databind-2.14.2.jar} +0 -0
- data/vendor/jar-dependencies/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.14.2/jackson-dataformat-xml-2.14.2.jar +0 -0
- data/vendor/jar-dependencies/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.14.2/jackson-datatype-jsr310-2.14.2.jar +0 -0
- data/{lib/com/fasterxml/woodstox/woodstox-core/6.2.4/woodstox-core-6.2.4.jar → vendor/jar-dependencies/com/fasterxml/woodstox/woodstox-core/6.5.0/woodstox-core-6.5.0.jar} +0 -0
- data/vendor/jar-dependencies/com/microsoft/azure/kusto/kusto-data/5.0.2/kusto-data-5.0.2.jar +0 -0
- data/vendor/jar-dependencies/com/microsoft/azure/kusto/kusto-ingest/5.0.2/kusto-ingest-5.0.2.jar +0 -0
- data/vendor/jar-dependencies/com/microsoft/azure/msal4j/1.13.8/msal4j-1.13.8.jar +0 -0
- data/{lib/com/microsoft/azure/msal4j-persistence-extension/1.1.0/msal4j-persistence-extension-1.1.0.jar → vendor/jar-dependencies/com/microsoft/azure/msal4j-persistence-extension/1.2.0/msal4j-persistence-extension-1.2.0.jar} +0 -0
- data/vendor/jar-dependencies/com/nimbusds/content-type/2.2/content-type-2.2.jar +0 -0
- data/vendor/jar-dependencies/com/nimbusds/lang-tag/1.7/lang-tag-1.7.jar +0 -0
- data/vendor/jar-dependencies/com/nimbusds/nimbus-jose-jwt/9.30.2/nimbus-jose-jwt-9.30.2.jar +0 -0
- data/vendor/jar-dependencies/com/nimbusds/oauth2-oidc-sdk/10.7.1/oauth2-oidc-sdk-10.7.1.jar +0 -0
- data/vendor/jar-dependencies/commons-codec/commons-codec/1.13/commons-codec-1.13.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-buffer/4.1.94.Final/netty-buffer-4.1.94.Final.jar +0 -0
- data/{lib/io/netty/netty-codec/4.1.68.Final/netty-codec-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-codec/4.1.94.Final/netty-codec-4.1.94.Final.jar} +0 -0
- data/{lib/io/netty/netty-codec-dns/4.1.68.Final/netty-codec-dns-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-codec-dns/4.1.94.Final/netty-codec-dns-4.1.94.Final.jar} +0 -0
- data/{lib/io/netty/netty-codec-http/4.1.68.Final/netty-codec-http-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-codec-http/4.1.94.Final/netty-codec-http-4.1.94.Final.jar} +0 -0
- data/{lib/io/netty/netty-codec-http2/4.1.68.Final/netty-codec-http2-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-codec-http2/4.1.94.Final/netty-codec-http2-4.1.94.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-codec-socks/4.1.94.Final/netty-codec-socks-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-common/4.1.94.Final/netty-common-4.1.94.Final.jar +0 -0
- data/{lib/io/netty/netty-handler/4.1.68.Final/netty-handler-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-handler/4.1.94.Final/netty-handler-4.1.94.Final.jar} +0 -0
- data/{lib/io/netty/netty-handler-proxy/4.1.68.Final/netty-handler-proxy-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-handler-proxy/4.1.94.Final/netty-handler-proxy-4.1.94.Final.jar} +0 -0
- data/{lib/io/netty/netty-resolver/4.1.68.Final/netty-resolver-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-resolver/4.1.94.Final/netty-resolver-4.1.94.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-resolver-dns/4.1.94.Final/netty-resolver-dns-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-resolver-dns-classes-macos/4.1.94.Final/netty-resolver-dns-classes-macos-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-resolver-dns-native-macos/4.1.94.Final/netty-resolver-dns-native-macos-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-tcnative-classes/2.0.61.Final/netty-tcnative-classes-2.0.61.Final.jar +0 -0
- data/{lib/io/netty/netty-transport/4.1.68.Final/netty-transport-4.1.68.Final.jar → vendor/jar-dependencies/io/netty/netty-transport/4.1.94.Final/netty-transport-4.1.94.Final.jar} +0 -0
- data/vendor/jar-dependencies/io/netty/netty-transport-classes-epoll/4.1.94.Final/netty-transport-classes-epoll-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-transport-classes-kqueue/4.1.94.Final/netty-transport-classes-kqueue-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-transport-native-epoll/4.1.94.Final/netty-transport-native-epoll-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-transport-native-kqueue/4.1.94.Final/netty-transport-native-kqueue-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.94.Final/netty-transport-native-unix-common-4.1.94.Final.jar +0 -0
- data/vendor/jar-dependencies/io/projectreactor/netty/reactor-netty-core/1.0.33/reactor-netty-core-1.0.33.jar +0 -0
- data/vendor/jar-dependencies/io/projectreactor/netty/reactor-netty-http/1.0.33/reactor-netty-http-1.0.33.jar +0 -0
- data/{lib/io/projectreactor/reactor-core/3.4.10/reactor-core-3.4.10.jar → vendor/jar-dependencies/io/projectreactor/reactor-core/3.4.32/reactor-core-3.4.32.jar} +0 -0
- data/vendor/jar-dependencies/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar +0 -0
- data/vendor/jar-dependencies/net/java/dev/jna/jna-platform/5.13.0/jna-platform-5.13.0.jar +0 -0
- data/{lib/net/minidev/accessors-smart/2.4.7/accessors-smart-2.4.7.jar → vendor/jar-dependencies/net/minidev/accessors-smart/2.4.9/accessors-smart-2.4.9.jar} +0 -0
- data/{lib/net/minidev/json-smart/2.4.7/json-smart-2.4.7.jar → vendor/jar-dependencies/net/minidev/json-smart/2.4.10/json-smart-2.4.10.jar} +0 -0
- data/vendor/jar-dependencies/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar +0 -0
- data/vendor/jar-dependencies/org/apache/httpcomponents/httpclient/4.5.14/httpclient-4.5.14.jar +0 -0
- data/vendor/jar-dependencies/org/apache/httpcomponents/httpcore/4.4.16/httpcore-4.4.16.jar +0 -0
- data/vendor/jar-dependencies/org/logstash/outputs/logstash-output-kusto/2.0.1/logstash-output-kusto-2.0.1.jar +0 -0
- data/vendor/jar-dependencies/org/ow2/asm/asm/9.3/asm-9.3.jar +0 -0
- data/vendor/jar-dependencies/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar +0 -0
- data/version +1 -0
- metadata +111 -113
- data/lib/com/azure/azure-core/1.21.0/azure-core-1.21.0.jar +0 -0
- data/lib/com/azure/azure-core-http-netty/1.11.1/azure-core-http-netty-1.11.1.jar +0 -0
- data/lib/com/azure/azure-identity/1.3.7/azure-identity-1.3.7.jar +0 -0
- data/lib/com/fasterxml/jackson/core/jackson-annotations/2.13.0/jackson-annotations-2.13.0.jar +0 -0
- data/lib/com/fasterxml/jackson/core/jackson-core/2.12.5/jackson-core-2.12.5.jar +0 -0
- data/lib/com/fasterxml/jackson/core/jackson-core/2.13.0/jackson-core-2.13.0.jar +0 -0
- data/lib/com/fasterxml/jackson/core/jackson-databind/2.12.5/jackson-databind-2.12.5.jar +0 -0
- data/lib/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.12.5/jackson-dataformat-xml-2.12.5.jar +0 -0
- data/lib/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.5/jackson-datatype-jsr310-2.12.5.jar +0 -0
- data/lib/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.12.5/jackson-module-jaxb-annotations-2.12.5.jar +0 -0
- data/lib/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar +0 -0
- data/lib/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar +0 -0
- data/lib/com/google/guava/guava/24.1.1-jre/guava-24.1.1-jre.jar +0 -0
- data/lib/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar +0 -0
- data/lib/com/microsoft/azure/azure-keyvault-core/1.2.4/azure-keyvault-core-1.2.4.jar +0 -0
- data/lib/com/microsoft/azure/azure-storage/8.6.6/azure-storage-8.6.6.jar +0 -0
- data/lib/com/microsoft/azure/kusto/kusto-data/3.1.1/kusto-data-3.1.1.jar +0 -0
- data/lib/com/microsoft/azure/kusto/kusto-data/3.1.3/kusto-data-3.1.3.jar +0 -0
- data/lib/com/microsoft/azure/kusto/kusto-data/3.2.1/kusto-data-3.2.1.jar +0 -0
- data/lib/com/microsoft/azure/kusto/kusto-ingest/3.1.1/kusto-ingest-3.1.1.jar +0 -0
- data/lib/com/microsoft/azure/kusto/kusto-ingest/3.1.3/kusto-ingest-3.1.3.jar +0 -0
- data/lib/com/microsoft/azure/kusto/kusto-ingest/3.2.1/kusto-ingest-3.2.1.jar +0 -0
- data/lib/com/microsoft/azure/msal4j/1.11.0/msal4j-1.11.0.jar +0 -0
- data/lib/com/nimbusds/content-type/2.1/content-type-2.1.jar +0 -0
- data/lib/com/nimbusds/lang-tag/1.5/lang-tag-1.5.jar +0 -0
- data/lib/com/nimbusds/nimbus-jose-jwt/9.9.3/nimbus-jose-jwt-9.9.3.jar +0 -0
- data/lib/com/nimbusds/oauth2-oidc-sdk/9.7/oauth2-oidc-sdk-9.7.jar +0 -0
- data/lib/commons-codec/commons-codec/1.11/commons-codec-1.11.jar +0 -0
- data/lib/io/netty/netty-buffer/4.1.68.Final/netty-buffer-4.1.68.Final.jar +0 -0
- data/lib/io/netty/netty-codec-socks/4.1.68.Final/netty-codec-socks-4.1.68.Final.jar +0 -0
- data/lib/io/netty/netty-common/4.1.68.Final/netty-common-4.1.68.Final.jar +0 -0
- data/lib/io/netty/netty-resolver-dns/4.1.68.Final/netty-resolver-dns-4.1.68.Final.jar +0 -0
- data/lib/io/netty/netty-resolver-dns-native-macos/4.1.68.Final/netty-resolver-dns-native-macos-4.1.68.Final-osx-x86_64.jar +0 -0
- data/lib/io/netty/netty-tcnative-boringssl-static/2.0.43.Final/netty-tcnative-boringssl-static-2.0.43.Final.jar +0 -0
- data/lib/io/netty/netty-transport-native-epoll/4.1.68.Final/netty-transport-native-epoll-4.1.68.Final-linux-x86_64.jar +0 -0
- data/lib/io/netty/netty-transport-native-kqueue/4.1.68.Final/netty-transport-native-kqueue-4.1.68.Final-osx-x86_64.jar +0 -0
- data/lib/io/netty/netty-transport-native-unix-common/4.1.68.Final/netty-transport-native-unix-common-4.1.68.Final.jar +0 -0
- data/lib/io/projectreactor/netty/reactor-netty-core/1.0.11/reactor-netty-core-1.0.11.jar +0 -0
- data/lib/io/projectreactor/netty/reactor-netty-http/1.0.11/reactor-netty-http-1.0.11.jar +0 -0
- data/lib/jakarta/activation/jakarta.activation-api/1.2.1/jakarta.activation-api-1.2.1.jar +0 -0
- data/lib/jakarta/xml/bind/jakarta.xml.bind-api/2.3.2/jakarta.xml.bind-api-2.3.2.jar +0 -0
- data/lib/net/java/dev/jna/jna/5.5.0/jna-5.5.0.jar +0 -0
- data/lib/net/java/dev/jna/jna-platform/5.6.0/jna-platform-5.6.0.jar +0 -0
- data/lib/org/apache/commons/commons-lang3/3.11/commons-lang3-3.11.jar +0 -0
- data/lib/org/apache/commons/commons-text/1.9/commons-text-1.9.jar +0 -0
- data/lib/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar +0 -0
- data/lib/org/apache/httpcomponents/httpcore/4.4.15/httpcore-4.4.15.jar +0 -0
- data/lib/org/checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar +0 -0
- data/lib/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar +0 -0
- data/lib/org/json/json/20201115/json-20201115.jar +0 -0
- data/lib/org/ow2/asm/asm/9.1/asm-9.1.jar +0 -0
- data/lib/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/com/github/stephenc/jcip/jcip-annotations/1.0-1/jcip-annotations-1.0-1.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/com/univocity/univocity-parsers/2.9.1/univocity-parsers-2.9.1.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/commons-logging/commons-logging/1.2/commons-logging-1.2.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/io/github/resilience4j/resilience4j-core/1.7.1/resilience4j-core-1.7.1.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/io/github/resilience4j/resilience4j-retry/1.7.1/resilience4j-retry-1.7.1.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/io/vavr/vavr/0.10.2/vavr-0.10.2.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/io/vavr/vavr-match/0.10.2/vavr-match-0.10.2.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/org/apache/commons/commons-text/1.10.0/commons-text-1.10.0.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/org/codehaus/woodstox/stax2-api/4.2.1/stax2-api-4.2.1.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/org/jetbrains/annotations/22.0.0/annotations-22.0.0.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar +0 -0
- /data/{lib → vendor/jar-dependencies}/org/slf4j/slf4j-simple/1.8.0-beta4/slf4j-simple-1.8.0-beta4.jar +0 -0
@@ -1,81 +1,81 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'logstash/outputs/base'
|
4
|
-
require 'logstash/namespace'
|
5
|
-
require 'logstash/errors'
|
6
|
-
|
7
|
-
class LogStash::Outputs::Kusto < LogStash::Outputs::Base
|
8
|
-
##
|
9
|
-
# Bare-bones utility for running a block of code at an interval.
|
10
|
-
#
|
11
|
-
class Interval
|
12
|
-
##
|
13
|
-
# Initializes a new Interval with the given arguments and starts it
|
14
|
-
# before returning it.
|
15
|
-
#
|
16
|
-
# @param interval [Integer] (see: Interval#initialize)
|
17
|
-
# @param procsy [#call] (see: Interval#initialize)
|
18
|
-
#
|
19
|
-
# @return [Interval]
|
20
|
-
#
|
21
|
-
def self.start(interval, procsy)
|
22
|
-
new(interval, procsy).tap(&:start)
|
23
|
-
end
|
24
|
-
|
25
|
-
##
|
26
|
-
# @param interval [Integer]: time in seconds to wait between calling the given proc
|
27
|
-
# @param procsy [#call]: proc or lambda to call periodically; must not raise exceptions.
|
28
|
-
def initialize(interval, procsy)
|
29
|
-
@interval = interval
|
30
|
-
@procsy = procsy
|
31
|
-
|
32
|
-
# Mutex, ConditionVariable, etc.
|
33
|
-
@mutex = Mutex.new
|
34
|
-
@sleeper = ConditionVariable.new
|
35
|
-
end
|
36
|
-
|
37
|
-
##
|
38
|
-
# Starts the interval, or returns if it has already been started.
|
39
|
-
#
|
40
|
-
# @return [void]
|
41
|
-
def start
|
42
|
-
@mutex.synchronize do
|
43
|
-
return if @thread && @thread.alive?
|
44
|
-
|
45
|
-
@thread = Thread.new { run }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
##
|
50
|
-
# Stop the interval.
|
51
|
-
# Does not interrupt if execution is in-progress.
|
52
|
-
def stop
|
53
|
-
@mutex.synchronize do
|
54
|
-
@stopped = true
|
55
|
-
end
|
56
|
-
|
57
|
-
@thread && @thread.join
|
58
|
-
end
|
59
|
-
|
60
|
-
##
|
61
|
-
# @return [Boolean]
|
62
|
-
def alive?
|
63
|
-
@thread && @thread.alive?
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def run
|
69
|
-
@mutex.synchronize do
|
70
|
-
loop do
|
71
|
-
@sleeper.wait(@mutex, @interval)
|
72
|
-
break if @stopped
|
73
|
-
|
74
|
-
@procsy.call
|
75
|
-
end
|
76
|
-
end
|
77
|
-
ensure
|
78
|
-
@sleeper.broadcast
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'logstash/outputs/base'
|
4
|
+
require 'logstash/namespace'
|
5
|
+
require 'logstash/errors'
|
6
|
+
|
7
|
+
class LogStash::Outputs::Kusto < LogStash::Outputs::Base
|
8
|
+
##
|
9
|
+
# Bare-bones utility for running a block of code at an interval.
|
10
|
+
#
|
11
|
+
class Interval
|
12
|
+
##
|
13
|
+
# Initializes a new Interval with the given arguments and starts it
|
14
|
+
# before returning it.
|
15
|
+
#
|
16
|
+
# @param interval [Integer] (see: Interval#initialize)
|
17
|
+
# @param procsy [#call] (see: Interval#initialize)
|
18
|
+
#
|
19
|
+
# @return [Interval]
|
20
|
+
#
|
21
|
+
def self.start(interval, procsy)
|
22
|
+
new(interval, procsy).tap(&:start)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# @param interval [Integer]: time in seconds to wait between calling the given proc
|
27
|
+
# @param procsy [#call]: proc or lambda to call periodically; must not raise exceptions.
|
28
|
+
def initialize(interval, procsy)
|
29
|
+
@interval = interval
|
30
|
+
@procsy = procsy
|
31
|
+
|
32
|
+
# Mutex, ConditionVariable, etc.
|
33
|
+
@mutex = Mutex.new
|
34
|
+
@sleeper = ConditionVariable.new
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Starts the interval, or returns if it has already been started.
|
39
|
+
#
|
40
|
+
# @return [void]
|
41
|
+
def start
|
42
|
+
@mutex.synchronize do
|
43
|
+
return if @thread && @thread.alive?
|
44
|
+
|
45
|
+
@thread = Thread.new { run }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Stop the interval.
|
51
|
+
# Does not interrupt if execution is in-progress.
|
52
|
+
def stop
|
53
|
+
@mutex.synchronize do
|
54
|
+
@stopped = true
|
55
|
+
end
|
56
|
+
|
57
|
+
@thread && @thread.join
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# @return [Boolean]
|
62
|
+
def alive?
|
63
|
+
@thread && @thread.alive?
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def run
|
69
|
+
@mutex.synchronize do
|
70
|
+
loop do
|
71
|
+
@sleeper.wait(@mutex, @interval)
|
72
|
+
break if @stopped
|
73
|
+
|
74
|
+
@procsy.call
|
75
|
+
end
|
76
|
+
end
|
77
|
+
ensure
|
78
|
+
@sleeper.broadcast
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|