regist(name, ro)
click to toggle source
def regist(name, ro)
synchronize do
@servers[name] = ro
@cond.signal
end
self
end
service(name)
click to toggle source
def service(name)
synchronize do
while true
server = @servers[name]
return server if server&.alive?
invoke_service(name)
@cond.wait
end
end
end
unregist(name)
click to toggle source
def unregist(name)
synchronize do
@servers.delete(name)
end
end