From: Madan Manoharan Date: 2006-05-18T12:03:24+09:00 Subject: Asynchronous calls in DRb ------=_Part_57739_3120470.1147921402167 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello: I am thinking about writing a distributed application in Ruby where the application would process all computationally intensive activities in a 'dedicated' server. As I was digging thro' drb/drb.rb, I found the following: def send_message(ref, msg_id, arg, block) # :nodoc: @protocol.send_request(ref, msg_id, arg, block) @protocol.recv_reply <----------- of interest end in the class DRbConn; and def main_loop Thread.start(@protocol.accept) do |client| @grp.add Thread.current Thread.current['DRb'] =3D { 'client' =3D> client , 'server' =3D> self } loop do begin succ =3D false invoke_method =3D InvokeMethod.new(self, client) succ, result =3D invoke_method.perform if !succ && verbose p result result.backtrace.each do |x| puts x end end client.send_reply(succ, result) rescue nil <----------- of interest ensure unless succ client.close break end end end end end end in the class DRbServer. Clearly, DRb is synchronous. This would mean that my 'client' cannot hand off the job to the 'server' and do other things when the 'server' is doing the computationally intensive job (parallel execution of the 'client' and 'server' is not possible as the 'client' will be blocked waiting for reply from the 'server'). My questions are: (1) Is there a way for me to make asynchronous calls in DRb; in other words= , am I overlooking that functionality? (2) If there is no asynchronous call capabilities in DRb, why was that not added when it could have been easily done (not call client.send_reply and recv_reply)? Is there a technical reason for it? Any help will be greatly appreciated. Thanks, Madan. ------=_Part_57739_3120470.1147921402167--