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.
25 26 27 28 29 30 31 32 33 |
# File 'lib/drb/extservm.rb', line 25 def initialize super() @cond = new_cond @servers = {} @waiting = [] @queue = Thread::Queue.new @thread = invoke_thread @uri = nil end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
34 35 36 |
# File 'lib/drb/extservm.rb', line 34 def uri @uri end |
Class Method Details
.command ⇒ Object
17 18 19 |
# File 'lib/drb/extservm.rb', line 17 def self.command @@command end |
.command=(cmd) ⇒ Object
21 22 23 |
# File 'lib/drb/extservm.rb', line 21 def self.command=(cmd) @@command = cmd end |
Instance Method Details
#regist(name, ro) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/drb/extservm.rb', line 47 def regist(name, ro) synchronize do @servers[name] = ro @cond.signal end self end |
#service(name) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/drb/extservm.rb', line 36 def service(name) synchronize do while true server = @servers[name] return server if server && server.alive? # server may be `false' invoke_service(name) @cond.wait end end end |
#unregist(name) ⇒ Object
55 56 57 58 59 |
# File 'lib/drb/extservm.rb', line 55 def unregist(name) synchronize do @servers.delete(name) end end |