Permalink
Browse files

Merge branch 'master' of https://github.com/madvertise/zookeeper into…

… pull29

Conflicts:
	Gemfile
  • Loading branch information...
2 parents 6ddc4d5 + 7588bf9 commit 39a0fa93b3d85c817835400b13a7214d8700169e @slyphon slyphon committed Dec 17, 2012
Showing with 19 additions and 11 deletions.
  1. +2 −3 Gemfile
  2. +17 −8 java/java_base.rb
View
@@ -5,10 +5,9 @@ gemspec
gem 'rake', '~> 0.9.0'
group :test do
- gem "rspec", "~> 2.8.0"
- gem 'eventmachine', '1.0.0.beta.4'
+ gem "rspec" , "~> 2.11"
+ gem 'eventmachine', '1.0.0'
gem 'evented-spec', '~> 0.9.0'
-
gem 'zk-server', '~> 1.0'
end
View
@@ -440,17 +440,26 @@ def jzk
@mutex.synchronize { @jzk }
end
- def handle_keeper_exception
- yield
- rescue JZK::KeeperException => e
- if e.respond_to?(:cause) and e.cause and e.cause.respond_to?(:code) and e.cause.code and e.cause.code.respond_to?(:intValue)
- e.cause.code.intValue
- else
- raise e # dunno what happened, just raise it
+ # java exceptions are not wrapped anymore in JRuby 1.7+
+ if JRUBY_VERSION >= '1.7.0'
+ def handle_keeper_exception
+ yield
+ rescue JZK::KeeperException => e
+ # code is an enum and always set -> we don't need any additional checks here
+ e.code.intValue
+ end
+ else
+ def handle_keeper_exception
+ yield
+ rescue JZK::KeeperException => e
+ if e.respond_to?(:cause) and e.cause and e.cause.respond_to?(:code) and e.cause.code and e.cause.code.respond_to?(:intValue)
+ e.cause.code.intValue
+ else
+ raise e # dunno what happened, just raise it
+ end
end
end
-
def call_type(callback, watcher)
if callback
watcher ? :async_watch : :async

0 comments on commit 39a0fa9

Please sign in to comment.