blob: c54628b54c2064367e916f4c3b8aeb44a6253c60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
require 'drb/drb'
require 'drb/eq'
require 'rinda/ring'
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
|