Class: DRbFire::Protocol::ClientServerProxy
- Inherits:
-
Object
- Object
- DRbFire::Protocol::ClientServerProxy
- Defined in:
- lib/drb/drbfire.rb
Instance Method Summary collapse
-
#initialize(connection, id) ⇒ ClientServerProxy
constructor
A new instance of ClientServerProxy.
- #open ⇒ Object
- #push(connection) ⇒ Object
- #write_signal_id ⇒ Object
Constructor Details
#initialize(connection, id) ⇒ ClientServerProxy
Returns a new instance of ClientServerProxy.
137 138 139 140 141 |
# File 'lib/drb/drbfire.rb', line 137 def initialize(connection, id) @connection = connection @id = id @queue = Queue.new end |
Instance Method Details
#open ⇒ Object
151 152 153 154 155 156 157 158 |
# File 'lib/drb/drbfire.rb', line 151 def open @connection.stream.write("0") timeout(20) do @queue.pop end rescue TimeoutError raise DRb::DRbConnError, "Unable to get a client connection." end |
#push(connection) ⇒ Object
147 148 149 |
# File 'lib/drb/drbfire.rb', line 147 def push(connection) @queue.push(connection) end |
#write_signal_id ⇒ Object
143 144 145 |
# File 'lib/drb/drbfire.rb', line 143 def write_signal_id @connection.stream.write([@id].pack(ID_FORMAT)) end |