Class: DRb::ExtServManager
- Inherits:
-
Object
- Object
- DRb::ExtServManager
- Includes:
- DRbUndumped, MonitorMixin
- Defined in:
- lib/drb/extservm.rb
Constant Summary collapse
- @@command =
{}
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ExtServManager
constructor
A new instance of ExtServManager.
- #regist(name, ro) ⇒ Object
- #service(name) ⇒ Object
- #unregist(name) ⇒ Object
Methods included from DRbUndumped
Constructor Details
#initialize ⇒ ExtServManager
Returns a new instance of ExtServManager.
26 27 28 29 30 31 32 33 34 |
# File 'lib/drb/extservm.rb', line 26 def initialize super() @cond = new_cond @servers = {} @waiting = [] @queue = Queue.new @thread = invoke_thread @uri = nil end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri
35 36 37 |
# File 'lib/drb/extservm.rb', line 35 def uri @uri end |
Class Method Details
.command ⇒ Object
18 19 20 |
# File 'lib/drb/extservm.rb', line 18 def self.command @@command end |
.command=(cmd) ⇒ Object
22 23 24 |
# File 'lib/drb/extservm.rb', line 22 def self.command=(cmd) @@command = cmd end |
Instance Method Details
#regist(name, ro) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/drb/extservm.rb', line 48 def regist(name, ro) synchronize do @servers[name] = ro @cond.signal end self end |
#service(name) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/drb/extservm.rb', line 37 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) ⇒ Object
56 57 58 59 60 |
# File 'lib/drb/extservm.rb', line 56 def unregist(name) synchronize do @servers.delete(name) end end |