Module: DTR::Service::Rinda

Included in:
Configuration, Agent, File, Runner, WorkingEnv
Defined in:
lib/dtr/shared/service/rinda.rb

Instance Method Summary collapse

Instance Method Details

#lookup(method, stuff, timeout = nil) ⇒ Object



39
40
41
# File 'lib/dtr/shared/service/rinda.rb', line 39

def lookup(method, stuff, timeout=nil)
  lookup_ring.send(method, stuff, timeout)
end

#lookup_ringObject



43
44
45
# File 'lib/dtr/shared/service/rinda.rb', line 43

def lookup_ring
  DTR.configuration.lookup_ring_any
end

#start_serviceObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dtr/shared/service/rinda.rb', line 22

def start_service
  DTR.info {"-- Start drb service..."}
  #todo need figure why agents couldn't be killed directly when start drb service by DRb.start_service
  if ENV['DTR_ENV'] == 'test'
    DRb.start_service("druby://#{Socket.gethostname}:0")
  else
    DRb.start_service
  end
rescue
  # for ruby 1.8.7 need specify uri
  DRb.start_service("druby://#{Socket.gethostname}:0")
end

#stop_serviceObject



35
36
37
# File 'lib/dtr/shared/service/rinda.rb', line 35

def stop_service
  DRb.stop_service
end