class Pione::DRbPatch::PioneDRbServer

Attributes

invoker_threads[R]

Public Class Methods

new(uri=nil, front=nil, config_or_acl=nil) click to toggle source
Calls superclass method
# File lib/pione/patch/drb-patch.rb, line 468
def initialize(uri=nil, front=nil, config_or_acl=nil)
  # current performing invokers
  @invoker_threads = ThreadGroup.new

  super
end

Public Instance Methods

main_loop() click to toggle source
# File lib/pione/patch/drb-patch.rb, line 475
def main_loop
  if @protocol.uri =~ /^receiver:/
    RequestLooper.start(self, @protocol)
    @thread.kill.join # stop transceiver
  else
    Thread.start(@protocol.accept) do |client|
      # relay socket doesn't need request receiver loop because its aim is
      # to get connection only
      unless @protocol.kind_of?(Pione::Relay::RelaySocket)
        # set DRb info to current thread
        Thread.current['DRb'] = {'client' => client, 'server' => self}

        # add exported uri
        DRb.mutex.synchronize do
          client_uri = client.uri
          @exported_uri << client_uri unless @exported_uri.include?(client_uri)
        end

        # start request loop
        RequestLooper.new(self).start(client)
      end
    end
  end

  def stop_service
    # stop invokers
    @invoker_threads.list.each {|thread| thread.kill.join}

    # stop main loop etc.
    super
  end
end
stop_service() click to toggle source
Calls superclass method
# File lib/pione/patch/drb-patch.rb, line 499
def stop_service
  # stop invokers
  @invoker_threads.list.each {|thread| thread.kill.join}

  # stop main loop etc.
  super
end