soar_sr 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d5e4239ec6dbf478aa8215b23131b4a16301a1b
4
- data.tar.gz: e24020042cfd7bfa82a56ea9f1e40ca446a28184
3
+ metadata.gz: 994cbaba1fd332b69c03daf1978eae61e468b8d2
4
+ data.tar.gz: 798996ba2a81adb302d0f70ead4438660a235dab
5
5
  SHA512:
6
- metadata.gz: 9aabd4bb7911c64bd4ff53384f7d6876ec3c1e4f4419668eba989e97652381d2b9efc038f606b98b9c9c84a6df15866c61824c4269f84d798ef9aea6d736b463
7
- data.tar.gz: 83b6e08166f7029c510ffa91c55e22933c4ca4acf4419b28bb500bfa7681a0fb6dc5341521fabf8b0680b8b2ad78c44ff8c319f36afc61f2abac9d9b5128c908
6
+ metadata.gz: 1cb204c69e50a3626f1d7006f59dfdf283559416d0a97fd9b93aa90e53d3e99aec441bf515d978b9e8e57dc192868e9ad66e22f32e2be8ade6765b63a34ab686
7
+ data.tar.gz: 483073f2c989f8b30d630adf58835594c46705f561c95949eb640a0ddd00ece0c663a6dc0fb2434a0dfb63c4baa6379edbf21cae352ba43d12561d42708091ee
@@ -7,6 +7,13 @@ module SoarSr
7
7
  class Services < SoarSr::Handler
8
8
  include Jsender
9
9
  ALL_SERVICES = nil unless defined? ALL_SERVICES; ALL_SERVICES.freeze
10
+ attr_accessor :max_threads
11
+
12
+ def initialize(urns, uddi, credentials, registry, max_threads = 15)
13
+ super(urns, uddi, credentials, registry)
14
+ @@mutex = Mutex.new
15
+ @max_threads = max_threads
16
+ end
10
17
 
11
18
  def register_service(service, description = nil)_{
12
19
  service = standardize(service)
@@ -134,13 +141,6 @@ module SoarSr
134
141
  success_data({'services' => found})
135
142
  end
136
143
 
137
- def map_service_uris(services)
138
- services_detailed = {}
139
- services.each do |id, service|
140
- service['uris'] = service_uris(service['name'])['data']['bindings']
141
- end
142
- end
143
-
144
144
  def extract_service_by_name_from_services_list(result, name)
145
145
  result['data']['services'].each do |sname, service|
146
146
  compare_service = "#{@urns['services']}#{name}" == sname
@@ -168,5 +168,60 @@ module SoarSr
168
168
  found
169
169
  end
170
170
 
171
+ def map_service_uris(services)
172
+ 90.times do
173
+ threads = []
174
+ services.each do |id, service|
175
+ threads = map_service_uri_threaded(threads, service)
176
+ end
177
+ join_threads(threads)
178
+ end
179
+ services
180
+ end
181
+
182
+ def join_threads(threads)
183
+ threads.each do |t|
184
+ t.join
185
+ end
186
+ end
187
+
188
+ def join_on_max_threads(threads)
189
+ if threads.count == @max_threads
190
+ join_threads(threads)
191
+ threads = []
192
+ end
193
+ threads
194
+ end
195
+
196
+ def map_service_uri_threaded(threads, service)
197
+ thread = nil
198
+ threads = join_on_max_threads(threads)
199
+ threads << Thread.new do
200
+ map_service_uri_thread_safe(service)
201
+ end
202
+ threads
203
+ end
204
+
205
+ def map_service_uri_thread_safe(service)
206
+ name = service_name_thread_safe(service)
207
+ result = service_uris(name)
208
+ uris = result['data'].nil? ? {} : result['data']['bindings']
209
+ service_uris_thread_safe(service, uris)
210
+ end
211
+
212
+ def service_name_thread_safe(service)
213
+ name = nil
214
+ @@mutex.synchronize do
215
+ name = service['name']
216
+ end
217
+ name
218
+ end
219
+
220
+ def service_uris_thread_safe(service, uris)
221
+ @@mutex.synchronize do
222
+ service['uris'] = uris
223
+ end
224
+ service
225
+ end
171
226
  end
172
227
  end
@@ -1,3 +1,3 @@
1
1
  module SoarSr
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
data/soar_sr.gemspec CHANGED
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "byebug"
28
28
  spec.add_dependency "jsender"
29
29
  spec.add_dependency "soap4juddi", "~> 1.0.1"
30
+ spec.add_dependency "connection_pool"
30
31
  end
metadata CHANGED
@@ -1,113 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar_sr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: persistent-cache
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: byebug
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: jsender
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: soap4juddi
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.0.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.0.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: connection_pool
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: Implementation of the Hetzner Service Registry specification, backed
112
126
  by jUDDI
113
127
  email:
@@ -116,9 +130,9 @@ executables: []
116
130
  extensions: []
117
131
  extra_rdoc_files: []
118
132
  files:
119
- - .gitignore
120
- - .rspec
121
- - .travis.yml
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".travis.yml"
122
136
  - CODE_OF_CONDUCT.md
123
137
  - Gemfile
124
138
  - LICENSE.txt
@@ -153,17 +167,17 @@ require_paths:
153
167
  - lib
154
168
  required_ruby_version: !ruby/object:Gem::Requirement
155
169
  requirements:
156
- - - '>='
170
+ - - ">="
157
171
  - !ruby/object:Gem::Version
158
172
  version: 2.0.0
159
173
  required_rubygems_version: !ruby/object:Gem::Requirement
160
174
  requirements:
161
- - - '>='
175
+ - - ">="
162
176
  - !ruby/object:Gem::Version
163
177
  version: '0'
164
178
  requirements: []
165
179
  rubyforge_project:
166
- rubygems_version: 2.2.2
180
+ rubygems_version: 2.4.8
167
181
  signing_key:
168
182
  specification_version: 4
169
183
  summary: Implementation of the Hetzner Service Registry specification, backed by jUDDI