hazelcast-client 0.0.3-jruby → 0.0.4-jruby

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -32,6 +32,14 @@ Let's open another console to check how this distributed hash works:
32
32
 
33
33
  >> 1
34
34
 
35
+ == Client
36
+
37
+ You can get your own client by providing the group name, password and hosts:
38
+
39
+ client = Hazelcast::Client.new 'dev', 'dev-pass', 'localhost'
40
+
41
+
42
+
35
43
  == Note on Patches/Pull Requests
36
44
 
37
45
  * Fork the project.
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ begin
25
25
  gem.executables = FileList['bin/*'].map { |f| File.basename(f) }
26
26
  gem.require_paths = ["lib"]
27
27
 
28
- gem.add_dependency "hazelcast-jars", "1.9.1"
28
+ gem.add_dependency "hazelcast-jars", "1.9.4.8"
29
29
  end
30
30
  Jeweler::GemcutterTasks.new
31
31
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -105,7 +105,7 @@ module Hazelcast
105
105
 
106
106
  end
107
107
 
108
- %w{ map queue topic }.each do |name|
108
+ %w{ lock map queue topic }.each do |name|
109
109
  require Hazelcast::Client::GEM_ROOT + '/hazelcast-client/' + name
110
110
  end
111
111
 
@@ -0,0 +1,27 @@
1
+ class Java::ComHazelcastClient::LockClientProxy
2
+
3
+ # lock()
4
+ # unlock()
5
+
6
+ def locking(options = {})
7
+ raise "Must provide a block" unless block_given?
8
+ tries = options[:tries] || 1
9
+ timeout = options[:timeout] || 5
10
+ unit = options[:unit] || :seconds
11
+ unit = java.util.concurrent.TimeUnit.const_get unit.to_s.upcase if unit.is_a? Symbol
12
+ failed = options[:failed] || false
13
+ result = nil
14
+ while tries > 0
15
+ if try_lock(timeout, unit)
16
+ tries = 0
17
+ result = yield
18
+ unlock
19
+ return result
20
+ else
21
+ tries -= 1
22
+ end
23
+ end
24
+ failed
25
+ end
26
+
27
+ end
@@ -1,3 +1,5 @@
1
+ require 'yaml'
2
+
1
3
  class Java::ComHazelcastClient::QueueClientProxy
2
4
 
3
5
  alias_method :unlearned_poll, :poll
@@ -5,5 +7,5 @@ class Java::ComHazelcastClient::QueueClientProxy
5
7
  def poll(timeout = 5, unit = :seconds)
6
8
  unlearned_poll timeout, java.util.concurrent.TimeUnit.const_get(unit.to_s.upcase)
7
9
  end
8
-
10
+
9
11
  end
data/test/test_map.rb CHANGED
@@ -89,7 +89,7 @@ class TestRubyHazeHash < Test::Unit::TestCase
89
89
  k, v = "a1", "b2"
90
90
  map[k] = "b1"
91
91
  map[k] = v
92
- sleep 0.25
92
+ sleep 0.5
93
93
  puts "Notices : #{Notices.all.inspect}"
94
94
  assert_equal Notices.size, 2
95
95
  assert_equal Notices.first, "updated : #{k} : b1"
data/test/test_queue.rb CHANGED
@@ -1,15 +1,16 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+ require 'yaml'
2
3
 
3
4
  class TestRubyHazeQueue < Test::Unit::TestCase
4
5
 
5
6
  def test_single_queing
6
7
  tasks = CLIENT.queue :test_single
7
8
  qty = 50
8
- qty.times { |idx| tasks.put [idx, Process.pid] }
9
+ qty.times { |idx| tasks.put idx }
9
10
  found = []
10
11
  while !tasks.empty? do
11
12
  task = tasks.poll
12
- found << task
13
+ found << YAML::load(task)
13
14
  end
14
15
  assert !found.empty?
15
16
  assert_equal found.size, qty
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hazelcast-client
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: jruby
7
7
  authors:
8
8
  - Adrian Madrid
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-01-22 00:00:00 -07:00
14
- default_executable: hazelcast-client-console
13
+ date: 2012-02-10 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: hazelcast-jars
@@ -21,7 +20,7 @@ dependencies:
21
20
  requirements:
22
21
  - - "="
23
22
  - !ruby/object:Gem::Version
24
- version: 1.9.1
23
+ version: 1.9.4.8
25
24
  type: :runtime
26
25
  version_requirements: *id001
27
26
  description: Hazelcast::Client is a little gem that wraps the Java Hazelcast Client library into a more comfortable JRuby package.
@@ -41,6 +40,7 @@ files:
41
40
  - VERSION
42
41
  - bin/hazelcast-client-console
43
42
  - lib/hazelcast-client.rb
43
+ - lib/hazelcast-client/lock.rb
44
44
  - lib/hazelcast-client/map.rb
45
45
  - lib/hazelcast-client/queue.rb
46
46
  - lib/hazelcast-client/topic.rb
@@ -48,7 +48,6 @@ files:
48
48
  - test/test_map.rb
49
49
  - test/test_queue.rb
50
50
  - test/test_topic.rb
51
- has_rdoc: true
52
51
  homepage: ""
53
52
  licenses: []
54
53
 
@@ -72,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
71
  requirements: []
73
72
 
74
73
  rubyforge_project: hazelcast-client
75
- rubygems_version: 1.4.2
74
+ rubygems_version: 1.8.9
76
75
  signing_key:
77
76
  specification_version: 3
78
77
  summary: Connecting to a Hazelcast Cluster has never been easier!