Sha256: 77443af97f437b6a43de741208dc8257ce6d0f411a2663694f7e9f235105edb2

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

module ZK
  module Client
    # This client is an experimental implementation of a threaded and
    # multiplexed client. The idea is that each synchronous request represents 
    # a continuation. This way, you can have multiple requests pending with the
    # server simultaneously, and the responses will be delivered on the event
    # thread (but run in the calling thread). This allows for higher throughput
    # for multi-threaded applications.
    #
    # Asynchronous requests are not supported through this client.
    #
    class Multiplexed < Threaded
      def close!
        @cnx.connection_closed!
        super
      end

      protected
        def create_connection(*args)
          ContinuationProxy.new.tap do |cp|
            on_expired_session { cp.expired_session! } # hook up client's session expired event listener
            cp.zookeeper_cnx = super(*args)
          end
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zk-0.9.1 lib/z_k/client/multiplexed.rb
zk-0.9.0 lib/z_k/client/multiplexed.rb