Class: DRb::ExtServ

Inherits:
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

Methods included from MonitorMixin

extend_object, #mon_enter, #mon_exit, #mon_synchronize, #mon_try_enter, #new_cond

Constructor Details

- (ExtServ) initialize(there, name, server = nil)

A new instance of ExtServ



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

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

- (Object) server (readonly)

Returns the value of attribute server



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

def server
  @server
end

Instance Method Details

- (Boolean) alive?

Returns:

  • (Boolean)


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

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

- (Object) front



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

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

- (Object) stop_service



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

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