march_hare 4.1.0-java → 4.4.0-java

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
  SHA256:
3
- metadata.gz: d8fa8b82fb0e6e8a81f4734cc1aa5df2f4566b078b4b89485a915aa224cb0f68
4
- data.tar.gz: fb24515cbd8e0e65e052d9fc1eedfb7c33423f7c5faf4fa6aae7445cb4285cbe
3
+ metadata.gz: 3515365e0557a86fbd8e420d7fdbe43aa18c063fc34d86d94f5af449d0f1fa0c
4
+ data.tar.gz: da9a5a017bfcff8f29452a33cba121ff7dea8a9c0db2fa1eb56bd5fbe9f94e8a
5
5
  SHA512:
6
- metadata.gz: 7d3cf202d16652aeb89b129c695ce42dbe0ddce9930ca259c612cb5f8fb0581eb1345b916393d9456798343ee9fdce3518885587250d478e7c000974929fe59c
7
- data.tar.gz: 6563c124ce5a8817827526355d819bd6fbe585513c91164fc511576196b2f09c9ede5c246537f615848fb256149dd6ffaedef9b323bd62cb3d00be24d5c0129b
6
+ metadata.gz: 9df022f62afcef6c1aec7e8355fe1eb2e7b891d4efb51bd644fc5fafff2633e1cf21d8a7b08924baf04874c20e1bae9c43a393e0d0c2f3f1656bca8b649673f8
7
+ data.tar.gz: d8bb0b7c50e50c1ea78a23ae652c66c424f073785c95573b1f365ec11ea84959ea607cb7e9eee1394a66a5702d32ad6b8d2f5ddb90242316d847bfa2e1d00aa6
Binary file
Binary file
Binary file
@@ -16,6 +16,12 @@ module MarchHare
16
16
  class ConnectionRefused < NetworkException
17
17
  end
18
18
 
19
+ class ConnectionClosedException < Exception
20
+ def initialize(message='')
21
+ super("Connection was explicitly closed and cannot be reopened. Create a new Connection instead. #{message}")
22
+ end
23
+ end
24
+
19
25
  class ChannelLevelException < Exception
20
26
  attr_reader :channel_close
21
27
 
@@ -86,7 +86,7 @@ module MarchHare
86
86
  elsif value.is_a?(java.util.List)
87
87
  value.map {|v| deep_normalize_headers(v)}
88
88
  else
89
- if value.java_kind_of?(LONG_STRING_TYPE)
89
+ if value.kind_of?(LONG_STRING_TYPE)
90
90
  value.to_s
91
91
  else
92
92
  value
@@ -88,7 +88,7 @@ module MarchHare
88
88
  when true then
89
89
  cf.use_ssl_protocol
90
90
  when String then
91
- opts[:logger].info("Using TLS/SSL version #{tls}") if opts[:logger]
91
+ options[:logger].info("Using TLS/SSL version #{tls}") if options[:logger]
92
92
  # Note: `options[:trust_manager] = com.rabbitmq.client.TrustEverythingTrustManager.new`
93
93
  # can be set to effectively disable TLS verification.
94
94
  if (cert_path = tls_certificate_path_from(options)) && (password = tls_certificate_password_from(options))
@@ -103,7 +103,7 @@ module MarchHare
103
103
  kmf.init(ks, pwd)
104
104
 
105
105
  if options[:trust_manager]
106
- ctx.init(kmf.get_key_managers, [options[:trust_manager]], nil)
106
+ ctx.init(kmf.get_key_managers, Array(options[:trust_manager]), nil)
107
107
  else
108
108
  # use the key store as the trust store
109
109
  tmf = TrustManagerFactory.get_instance(TrustManagerFactory.getDefaultAlgorithm());
@@ -111,6 +111,7 @@ module MarchHare
111
111
  ctx.init(kmf.get_key_managers, tmf.getTrustManagers(), nil)
112
112
  end
113
113
 
114
+ cf.set_sasl_config(options[:sasl_config]) if options[:sasl_config]
114
115
  cf.use_ssl_protocol(ctx)
115
116
  rescue Java::JavaLang::Throwable => e
116
117
  message = e.message
@@ -179,6 +180,7 @@ module MarchHare
179
180
  @shutdown_hooks = Array.new
180
181
  @blocked_connection_hooks = Array.new
181
182
  @connection_recovery_hooks = Array.new
183
+ @was_explicitly_closed = false
182
184
 
183
185
  if @automatically_recover
184
186
  self.add_automatic_recovery_hook
@@ -224,8 +226,16 @@ module MarchHare
224
226
  ch.close
225
227
  end
226
228
 
229
+ @was_explicitly_closed = true
227
230
  maybe_shut_down_executor
228
231
  @connection.close
232
+ rescue com.rabbitmq.client.AlreadyClosedException
233
+ @logger.debug("close: connection already closed")
234
+ end
235
+
236
+ def reopen
237
+ @was_explicitly_closed = false
238
+ automatically_recover
229
239
  end
230
240
 
231
241
  # @return [Boolean] true if connection is open, false otherwise
@@ -317,7 +327,8 @@ module MarchHare
317
327
  # Begins automatic connection recovery (typically only used internally
318
328
  # to recover from network failures)
319
329
  def automatically_recover
320
- @logger.debug("session: begin automatic connection recovery")
330
+ raise ConnectionClosedException if @was_explicitly_closed
331
+ @logger.debug("session: begin automatic connection recovery #{Thread.current.inspect}")
321
332
 
322
333
  fire_recovery_start_hooks
323
334
 
@@ -582,6 +593,7 @@ module MarchHare
582
593
  def reconnecting_on_network_failures(interval_in_ms, &fn)
583
594
  @logger.debug("session: reconnecting_on_network_failures")
584
595
  begin
596
+ return if @was_explicitly_closed
585
597
  fn.call
586
598
  rescue IOError, MarchHare::ConnectionRefused, java.io.IOException, java.util.concurrent.TimeoutException
587
599
  java.lang.Thread.sleep(interval_in_ms)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module MarchHare
4
- VERSION = "4.1.0"
4
+ VERSION = "4.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: march_hare
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.4.0
5
5
  platform: java
6
6
  authors:
7
7
  - Theo Hultberg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-09 00:00:00.000000000 Z
12
+ date: 2021-10-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: RabbitMQ client for JRuby built around the official RabbitMQ Java client
15
15
  email:
@@ -56,7 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.0.4
59
+ rubyforge_project: march_hare
60
+ rubygems_version: 2.7.10
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: RabbitMQ client for JRuby built around the official RabbitMQ Java client