You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2010/10/08 23:08:13 UTC

svn commit: r1006020 - in /avro/branches/branch-1.4: ./ CHANGES.txt lang/ruby/lib/avro/ipc.rb

Author: cutting
Date: Fri Oct  8 21:08:12 2010
New Revision: 1006020

URL: http://svn.apache.org/viewvc?rev=1006020&view=rev
Log:
Merge r1006019 from trunk to 1.4 branch.  Fixes: AVRO-537.

Modified:
    avro/branches/branch-1.4/   (props changed)
    avro/branches/branch-1.4/CHANGES.txt
    avro/branches/branch-1.4/lang/ruby/lib/avro/ipc.rb

Propchange: avro/branches/branch-1.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct  8 21:08:12 2010
@@ -1 +1 @@
-/avro/trunk:990852,990860,990867,990871,990878,991031,991423,992146,992149,992167,996640,996642,996649,996877,997962,998347,998354,999554,999556
+/avro/trunk:990852,990860,990867,990871,990878,991031,991423,992146,992149,992167,996640,996642,996649,996877,997962,998347,998354,999554,999556,1006019

Modified: avro/branches/branch-1.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.4/CHANGES.txt?rev=1006020&r1=1006019&r2=1006020&view=diff
==============================================================================
--- avro/branches/branch-1.4/CHANGES.txt (original)
+++ avro/branches/branch-1.4/CHANGES.txt Fri Oct  8 21:08:12 2010
@@ -19,6 +19,9 @@ Avro 1.4.1 (unreleased)
     AVRO-668. Java: Reduce object allocations while writing strings.
     (scottcarey)
 
+    AVRO-537. Ruby: Reuse client connection for multiple requests.
+    (Gabor Torok via cutting)
+
   BUG FIXES
 
     AVRO-657. Fix build so that md5 and sha1 checksum files contain

Modified: avro/branches/branch-1.4/lang/ruby/lib/avro/ipc.rb
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.4/lang/ruby/lib/avro/ipc.rb?rev=1006020&r1=1006019&r2=1006020&view=diff
==============================================================================
--- avro/branches/branch-1.4/lang/ruby/lib/avro/ipc.rb (original)
+++ avro/branches/branch-1.4/lang/ruby/lib/avro/ipc.rb Fri Oct  8 21:08:12 2010
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+require "net/http"
+
 module Avro::IPC
 
   class AvroRemoteError < Avro::AvroError; end
@@ -521,14 +523,13 @@ module Avro::IPC
     def initialize(host, port)
       @host, @port = host, port
       @remote_name = "#{host}:#{port}"
+      @conn = Net::HTTP.start host, port
     end
 
     def transceive(message)
       writer = FramedWriter.new(StringIO.new)
       writer.write_framed_message(message)
-      resp = Net::HTTP.start(host, port) do |http|
-        http.post('/', writer.to_s, {'Content-Type' => 'avro/binary'})
-      end
+      resp = @conn.post('/', writer.to_s, {'Content-Type' => 'avro/binary'})
       FramedReader.new(StringIO.new(resp.body)).read_framed_message
     end
   end