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.
- #register(name, ro) ⇒ Object (also: #regist)
- #service(name) ⇒ Object
- #unregister(name) ⇒ Object (also: #unregist)
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
#register(name, ro) ⇒ Object Also known as: regist
47 48 49 50 51 52 53 |
# File 'lib/drb/extservm.rb', line 47 def register(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 |
#unregister(name) ⇒ Object Also known as: unregist
56 57 58 59 60 |
# File 'lib/drb/extservm.rb', line 56 def unregister(name) synchronize do @servers.delete(name) end end |