Spec-Zone.ru › Ruby 2.7

класс DRb::DRbConn

Родитель:
Объект

Class обработка соединения между DRbObject и сервером, на котором находится реальный объект.

Этот класс поддерживает пул соединений, чтобы уменьшить накладные расходы на установление и закрытие соединений для каждого вызова метода.

Этот класс используется внутренне классом DRbObject. Пользователю обычно не нужно взаимодействовать с ним напрямую.

Публичные методы класса

make_pool() Показать исходный код
# File lib/drb/drb.rb, line 1258
def self.make_pool
  ThreadObject.new do |queue|
    pool = []
    while true
      queue._execute do |message|
        case(message[0])
        when :take then
          remote_uri = message[1]
          conn = nil
          new_pool = []
          pool.each do |c|
            if conn.nil? and c.uri == remote_uri
              conn = c if c.alive?
            else
              new_pool.push c
            end
          end
          pool = new_pool
          conn
        when :store then
          conn = message[1]
          pool.unshift(conn)
          pool.pop.close while pool.size > POOL_SIZE
          conn
        else
          nil
        end
      end
    end
  end
end
stop_pool() Показать исходный код
# File lib/drb/drb.rb, line 1291
def self.stop_pool
  @pool_proxy&.kill
  @pool_proxy = nil
end

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API