config root man

Current Path : /usr/local/share/examples/ruby18/drb/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/local/share/examples/ruby18/drb/ring_echo.rb

require 'drb/drb'
require 'drb/eq'
require 'rinda/ring'
require 'thread'

class RingEcho
  include DRbUndumped
  def initialize(name)
    @name = name
  end
  
  def echo(str)
    "#{@name}: #{str}"
  end
end

DRb.start_service

renewer = Rinda::SimpleRenewer.new

finder = Rinda::RingFinger.new
ts = finder.lookup_ring_any
ts.read_all([:name, :RingEcho, nil, nil]).each do |tuple|
  p tuple[2]
  puts tuple[2].echo('Hello, World') rescue nil
end
ts.write([:name, :RingEcho, RingEcho.new(DRb.uri), ''], renewer)

DRb.thread.join


Man Man