Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

… pull29

Conflicts:
	Gemfile
  • Loading branch information...
commit 39a0fa93b3d85c817835400b13a7214d8700169e 2 parents 6ddc4d5 + 7588bf9
@slyphon slyphon authored
Showing with 19 additions and 11 deletions.
  1. +2 −3 Gemfile
  2. +17 −8 java/java_base.rb
View
5 Gemfile
@@ -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
25 java/java_base.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.