rubyhaze 0.0.1-jruby → 0.0.2-jruby

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -29,6 +29,12 @@ module RubyHaze::BaseMixin
29
29
  name == other.name
30
30
  end
31
31
 
32
+ def rescue_native_exception(exception)
33
+ exception = exception.cause while exception.cause
34
+ exception.print_stack_trace
35
+ raise RubyHaze::HazelcastException(exception)
36
+ end
37
+
32
38
  module ClassMethods
33
39
 
34
40
  def [](name)
@@ -1,3 +1,4 @@
1
+ raise "Rubyhaze only runs on JRuby. Sorry!" unless (RUBY_PLATFORM =~ /java/)
1
2
  require 'java'
2
3
 
3
4
  module RubyHaze
data/lib/rubyhaze/map.rb CHANGED
@@ -9,69 +9,52 @@ class RubyHaze::Map
9
9
  def initialize(name)
10
10
  @name = name.to_s
11
11
  @hco = Hazelcast.get_map @name
12
- rescue => e
13
- puts e.errmsg
12
+ rescue NativeException => x
13
+ rescue_native_exception x
14
14
  end
15
15
 
16
16
  def each
17
17
  @hco.each do |(key, value)|
18
18
  yield key, value
19
19
  end
20
- rescue => e
21
- puts e.errmsg
20
+ rescue NativeException => x
21
+ rescue_native_exception x
22
22
  end
23
23
 
24
24
  def [](key)
25
25
  @hco[key.to_s]
26
26
  rescue NativeException => x
27
- x = x.cause while x.cause
28
- x.print_stack_trace
29
- rescue => e
30
- puts e.errmsg
27
+ rescue_native_exception x
31
28
  end
32
29
 
33
30
  def []=(key,value)
34
31
  @hco[key.to_s] = value
35
32
  rescue NativeException => x
36
- x = x.cause while x.cause
37
- x.print_stack_trace
38
- rescue => e
39
- puts e.errmsg
33
+ rescue_native_exception x
40
34
  end
41
35
 
42
36
  def keys(predicate = nil)
43
37
  @hco.key_set(prepare_predicate(predicate)).map
44
38
  rescue NativeException => x
45
- x = x.cause while x.cause
46
- x.print_stack_trace
47
- rescue => e
48
- puts e.errmsg
39
+ rescue_native_exception x
49
40
  end
50
41
 
51
42
  def values(predicate = nil)
52
43
  @hco.values(prepare_predicate(predicate)).map
53
44
  rescue NativeException => x
54
- x = x.cause while x.cause
55
- x.print_stack_trace
56
- rescue => e
57
- puts e.errmsg
45
+ rescue_native_exception x
58
46
  end
59
47
 
60
48
  def local_keys(predicate = nil)
61
49
  @hco.local_key_set(prepare_predicate(predicate)).map
62
50
  rescue NativeException => x
63
- x = x.cause while x.cause
64
- x.print_stack_trace
65
- rescue => e
66
- puts e.errmsg
51
+ rescue_native_exception x
67
52
  end
68
53
 
69
54
  def local_stats
70
55
  lsm = @hco.local_map_stats
71
56
  { :backup_count => lsm.backup_entry_count, :backup_memory => lsm.backup_entry_memory_cost,
72
57
  :created => lsm.creation_time, :last_accessed => lsm.last_access_time, }
73
- rescue => e
74
- puts e.errmsg
75
58
  end
76
59
 
77
60
  private
data/lib/rubyhaze/node.rb CHANGED
@@ -1,3 +1,4 @@
1
+ raise "Rubyhaze only runs on JRuby. Sorry!" unless (RUBY_PLATFORM =~ /java/)
1
2
  require 'java'
2
3
 
3
4
  module RubyHaze
@@ -108,7 +108,6 @@ module RubyHaze::Stored
108
108
  def field_options() fields.map { |ary| ary[2] } end
109
109
 
110
110
  def field(name, type, options = {})
111
- puts "Defining :#{name}, :#{type}, #{options.inspect}..."
112
111
  raise "Field [#{name} already defined" if field_names.include?(name)
113
112
  fields << [ name, type, options ]
114
113
  attr_accessor name
data/lib/rubyhaze.rb CHANGED
@@ -1,8 +1,10 @@
1
+ raise "Rubyhaze only runs on JRuby. Sorry!" unless (RUBY_PLATFORM =~ /java/)
1
2
  require 'java'
2
3
 
3
4
  module RubyHaze
4
5
 
5
6
  class Exception < StandardError; end
7
+ class HazelcastException < StandardError; end
6
8
 
7
9
  ROOT = File.expand_path File.join(File.dirname(__FILE__), '..') unless defined? ROOT
8
10
  LIB_PATH = ROOT + "/lib/rubyhaze" unless defined? LIB_PATH
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: jruby
11
11
  authors:
12
12
  - Adrian Madrid
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-05 00:00:00 -06:00
17
+ date: 2010-08-09 00:00:00 -06:00
18
18
  default_executable: rh_console
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency