Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pool_connection.zk.reopen not working with JRuby #99

Open
raphaelhetzel opened this issue Sep 4, 2017 · 0 comments
Open

pool_connection.zk.reopen not working with JRuby #99

raphaelhetzel opened this issue Sep 4, 2017 · 0 comments

Comments

@raphaelhetzel
Copy link

raphaelhetzel commented Sep 4, 2017

Hi,
i'm trying to reopen a connection from a pool in case of a ZK::Exceptions::ConnectionLoss error like described in #92.

I assume that i have to call reopen on connection.zk when using the pool.with_lock { |connection| } method.

However, this does not work with JRuby. Is this an issue with the gem or am i doing something wrong here?

require "bundler/inline"

gemfile true do
  source "https://rubygems.org" do
    gem "zk", "1.9.6"
  end
end
require "zk"

pool = ZK::Pool::Bounded.new(
  "127.0.0.1:2181",
  chroot:      "/test",
  timeout:     1,
  min_clients: 1,
  max_clients: 2
)

opts = { wait: 1 }

pool.with_lock("1234", opts) do |connection|
    puts connection.zk.connected?
    connection.zk.close!
    puts connection.zk.connected?
    puts connection.zk.reopen.inspect
    puts connection.zk.connected?
end

JRuby 9.1.12.0:

true
false
:connecting
false

Waiting longer for the client to be connected yields the same result.

MRI 2.3.3:

true
false
:connected
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant