Sha256: 16b26e1bb4510b1412ddc28faf89223d8d1997c1d3c9a13bd1e4963c343e094f
Contents?: true
Size: 1.2 KB
Versions: 48
Compression:
Stored size: 1.2 KB
Contents
require 'protobuf/rpc/servers/zmq/broker' require 'protobuf/rpc/servers/zmq/worker' require 'protobuf/rpc/servers/zmq/util' module Protobuf module Rpc module Zmq class Server include ::Protobuf::Rpc::Zmq::Util ## # Class Methods # def self.run(options = {}) log_debug { sign_message("initializing broker") } @broker = ::Protobuf::Rpc::Zmq::Broker.new(options) local_worker_threads = options[:threads] worker_options = options.merge(:port => options[:port] + 1) log_debug { sign_message("starting server workers") } local_worker_threads.times do @threads << Thread.new { ::Protobuf::Rpc::Zmq::Worker.new(worker_options).run } end @running = true log_debug { sign_message("server started") } while self.running? do @broker.poll end ensure @broker.teardown if @broker end def self.running? !!@running end def self.stop @running = false @threads.each do |t| t.join end end @threads ||= [] end end end end
Version data entries
48 entries across 48 versions & 1 rubygems