2004-02-13 21:28:02 -05:00
|
|
|
require 'drb/drb'
|
|
|
|
require 'drb/eq'
|
|
|
|
require 'rinda/ring'
|
|
|
|
require 'thread'
|
|
|
|
|
|
|
|
class RingEcho
|
|
|
|
include DRbUndumped
|
|
|
|
def initialize(name)
|
|
|
|
@name = name
|
|
|
|
end
|
2011-05-15 07:55:52 -04:00
|
|
|
|
2004-02-13 21:28:02 -05:00
|
|
|
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)
|
|
|
|
|
2004-06-27 11:36:32 -04:00
|
|
|
DRb.thread.join
|
2004-02-13 21:28:02 -05:00
|
|
|
|