Sha256: cfb05c2bf7ed7055f10d1d305b0f584d18771daf5e31e971765d457b19cb5545

Contents?: true

Size: 846 Bytes

Versions: 16

Compression:

Stored size: 846 Bytes

Contents

# This monkey-patch must be removed when ticket #44 has been included in
# an updated ZooKeeper Gem
#   Ticket:       https://github.com/slyphon/zookeeper/issues/44
#   Pull Request: https://github.com/slyphon/zookeeper/pull/45

module Zookeeper
  class JavaBase

    def get(req_id, path, callback, watcher)
      handle_keeper_exception do
        watch_cb = watcher ? create_watcher(req_id, path) : false

        if callback
          jzk.getData(path, watch_cb, JavaCB::DataCallback.new(req_id), event_queue)
          [Code::Ok, nil, nil]    # the 'nil, nil' isn't strictly necessary here
        else # sync
          stat = JZKD::Stat.new
          value = jzk.getData(path, watch_cb, stat)
          data = String.from_java_bytes(value) unless value.nil?

          [Code::Ok, data, stat.to_hash]
        end
      end
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_skynet-2.0.0 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.3.0.alpha3 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.3.0.alpha2 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.3.0.alpha1 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-2.0.0.rc1 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.7 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.6 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.5 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.4 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.3 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.2 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.1 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.2.0 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.1.1 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.1.0 lib/ruby_skynet/zookeeper/extensions/java_base.rb
ruby_skynet-1.0.0 lib/ruby_skynet/zookeeper/extensions/java_base.rb