march_hare 4.1.1-java → 4.2.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: 4991f2f1adcdad91fecd0e645b2d0c289292c12532a455e9df50745c28101eb9
4
- data.tar.gz: 65e579a293592cfd3047e66d5e109a7702ff881612b3c283d39de852a9a1f248
3
+ metadata.gz: 422e907691c9a23c9b3c34a399af78305115a4918f2a1d988bc333f0f46d21d6
4
+ data.tar.gz: 6423305f0730974e723e357954b0c430de23ee2b06548c477353c82e067df16e
5
5
  SHA512:
6
- metadata.gz: 13bdf0f2f0ea8ed22744f1e49d5f1446e7e08943b46876fbb9336902fe3274c928399464fa1830272a1cf2240e4f8b9a0e160f5b7890682efb9db25f4b9bc85b
7
- data.tar.gz: 7769151208e32f5a7bff6ea352d9fece4788b1f70da749b882cc369eec93dbeffed80952ce57c4575b4206e464ded9a05777ef976c2101863452ba56fefd6769
6
+ metadata.gz: 34431c6bb05c6ca03afa1f8181ab7dca28650be1e4188c854c28eb4d455825d12b620e0d2e4fbb87bff4f100876559b3cc07a1e1a47c18a5e63e531f14767288
7
+ data.tar.gz: 7965a6a8edcad1a181b00d6d016816370a7654dfb9321777ddf3ee7895ec948afceccfcf07319e7a9d6eb6bcdb4f619be76bdf76b5b9b557c7c4d522ffe572a3
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
 
@@ -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.1"
4
+ VERSION = "4.2.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.1
4
+ version: 4.2.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-09-13 00:00:00.000000000 Z
12
+ date: 2020-05-06 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