Class: DRb::ExtServ

Inherits:
Object
  • Object
show all
Includes:
DRbUndumped, MonitorMixin
Defined in:
lib/drb/extserv.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DRbUndumped

#_dump

Constructor Details

#initialize(there, name, server = nil) ⇒ ExtServ

Returns a new instance of ExtServ.



15
16
17
18
19
20
21
22
23
# File 'lib/drb/extserv.rb', line 15

def initialize(there, name, server=nil)
  super()
  @server = server || DRb::primary_server
  @name = name
  ro = DRbObject.new(nil, there)
  synchronize do
    @invoker = ro.regist(name, DRbObject.new(self, @server.uri))
  end
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



24
25
26
# File 'lib/drb/extserv.rb', line 24

def server
  @server
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/drb/extserv.rb', line 40

def alive?
  @server ? @server.alive? : false
end

#frontObject



26
27
28
# File 'lib/drb/extserv.rb', line 26

def front
  DRbObject.new(nil, @server.uri)
end

#stop_serviceObject



30
31
32
33
34
35
36
37
38
# File 'lib/drb/extserv.rb', line 30

def stop_service
  synchronize do
    @invoker.unregist(@name)
    server = @server
    @server = nil
    server.stop_service
    true
  end
end