avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1166326 - in /avro/trunk: CHANGES.txt lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java
Date Wed, 07 Sep 2011 19:31:09 GMT
Author: cutting
Date: Wed Sep  7 19:31:09 2011
New Revision: 1166326

URL: http://svn.apache.org/viewvc?rev=1166326&view=rev
Log:
AVRO-884.  Java: Fix a regression in RPC so that one-way messages fail when the transciever
cannot connect.  Contributed by Tom White.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java
    avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1166326&r1=1166325&r2=1166326&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed Sep  7 19:31:09 2011
@@ -50,6 +50,13 @@ Avro 1.6.0 (unreleased)
     AVRO-824. Java: Fix usage message of BinaryFragmentToJsonTool.
     (Jakob Homan via cutting)
 
+Avro 1.5.4 (unreleased)
+
+  BUG FIXES
+
+    AVRO-884.  Java: Fix a regression in RPC so that one-way messages
+    fail when the transciever cannot connect. (Tom White via cutting)
+
 Avro 1.5.3 (25 August 2011)
 
   IMPROVEMENTS

Modified: avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java?rev=1166326&r1=1166325&r2=1166326&view=diff
==============================================================================
--- avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java (original)
+++ avro/trunk/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java Wed Sep  7 19:31:09
2011
@@ -149,6 +149,16 @@ public abstract class Requestor {
                        new TransceiverCallback<T>(request, callFuture));
           // Block until handshake complete
           callFuture.await();
+          if (request.getMessage().isOneWay()) {
+            Throwable error = callFuture.getError();
+            if (error != null) {
+              if (error instanceof Exception) {
+                throw (Exception) error;
+              } else {
+                throw new AvroRemoteException(error);
+              }
+            }
+          }
           return;
         }
       } finally{

Modified: avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java?rev=1166326&r1=1166325&r2=1166326&view=diff
==============================================================================
--- avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java (original)
+++ avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java Wed Sep
 7 19:31:09 2011
@@ -17,6 +17,7 @@
  */
 package org.apache.avro;
 
+import org.apache.avro.ipc.HttpTransceiver;
 import org.apache.avro.ipc.RPCContext;
 import org.apache.avro.ipc.RPCPlugin;
 import org.apache.avro.ipc.Requestor;
@@ -50,6 +51,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.LineNumberReader;
 import java.net.InetSocketAddress;
+import java.net.URL;
 import java.nio.ByteBuffer;
 import java.util.Random;
 import java.util.List;
@@ -212,6 +214,15 @@ public class TestProtocolSpecific {
       proxy.hello("hi!");
     }
   }
+  
+  @Test(expected = Exception.class)
+  public void testConnectionRefusedOneWay() throws IOException {
+    Transceiver client = new HttpTransceiver(new URL("http://localhost:4444"));
+    SpecificRequestor req = new SpecificRequestor(Simple.class, client);
+    addRpcPlugins(req);
+    Simple proxy = SpecificRequestor.getClient(Simple.class, (SpecificRequestor)req);
+    proxy.ack();
+  }
 
   @Test
   /** Construct and use a protocol whose "hello" method has an extra



Mime
View raw message