march_hare 2.0.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ module MarchHare
2
+ class ShutdownListener
3
+ include com.rabbitmq.client.ShutdownListener
4
+
5
+ def initialize(entity, &block)
6
+ # connection or channel
7
+ @entity = entity
8
+ @block = block
9
+ end
10
+
11
+ def shutdown_completed(cause)
12
+ @block.call(@entity, cause)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,32 @@
1
+ require "march_hare/juc"
2
+
3
+ module MarchHare
4
+ # A slighly more Ruby developer-friendly way of instantiating various
5
+ # JDK executors (thread pools).
6
+ class ThreadPools
7
+ # Returns a new thread pool (JDK executor) of a fixed size.
8
+ #
9
+ # @return A thread pool (JDK executor)
10
+ def self.fixed_of_size(n)
11
+ raise ArgumentError.new("n must be a positive integer!") unless Integer === n
12
+ raise ArgumentError.new("n must be a positive integer!") unless n > 0
13
+
14
+ JavaConcurrent::Executors.new_fixed_thread_pool(n)
15
+ end
16
+
17
+ # Returns a new thread pool (JDK executor) of a fixed size of 1.
18
+ #
19
+ # @return A thread pool (JDK executor)
20
+ def self.single_threaded
21
+ JavaConcurrent::Executors.new_single_thread_executor
22
+ end
23
+
24
+ # Returns a new thread pool (JDK executor) that will create new
25
+ # threads as needed.
26
+ #
27
+ # @return A thread pool (JDK executor)
28
+ def self.dynamically_growing
29
+ JavaConcurrent::Executors.new_cached_thread_pool
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+
3
+ module MarchHare
4
+ VERSION = "2.0.0"
5
+ end
@@ -0,0 +1,28 @@
1
+ module MarchHare
2
+ # Wraps a delivery tag (which is an integer) so that {Bunny::Channel} could
3
+ # detect stale tags after connection recovery.
4
+ #
5
+ # @private
6
+ class VersionedDeliveryTag
7
+ attr_reader :tag
8
+ attr_reader :version
9
+
10
+ def initialize(tag, version)
11
+ raise ArgumentError.new("tag cannot be nil") unless tag
12
+ raise ArgumentError.new("version cannot be nil") unless version
13
+
14
+ @tag = tag
15
+ @version = version
16
+ end
17
+
18
+ def to_i
19
+ @tag
20
+ end
21
+
22
+ def stale?(version)
23
+ raise ArgumentError.new("version cannot be nil") unless version
24
+
25
+ @version < version
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: march_hare
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: java
6
+ authors:
7
+ - Theo Hultberg
8
+ - Michael S. Klishin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-12-05 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: RabbitMQ client for JRuby built around the official RabbitMQ Java client
15
+ email:
16
+ - theo@burtcorp.com
17
+ - michael@rabbitmq.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - lib/ext/commons-io.jar
23
+ - lib/ext/rabbitmq-client.jar
24
+ - lib/hot_bunnies.rb
25
+ - lib/march_hare.rb
26
+ - lib/march_hare/channel.rb
27
+ - lib/march_hare/consumers.rb
28
+ - lib/march_hare/consumers/base.rb
29
+ - lib/march_hare/consumers/blocking.rb
30
+ - lib/march_hare/exceptions.rb
31
+ - lib/march_hare/exchange.rb
32
+ - lib/march_hare/juc.rb
33
+ - lib/march_hare/metadata.rb
34
+ - lib/march_hare/queue.rb
35
+ - lib/march_hare/session.rb
36
+ - lib/march_hare/shutdown_listener.rb
37
+ - lib/march_hare/thread_pools.rb
38
+ - lib/march_hare/version.rb
39
+ - lib/march_hare/versioned_delivery_tag.rb
40
+ homepage: http://rubymarchhare.info
41
+ licenses: []
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project: march_hare
59
+ rubygems_version: 2.1.9
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: RabbitMQ client for JRuby built around the official RabbitMQ Java client
63
+ test_files: []