avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r989408 - in /avro/trunk: ./ lang/java/src/java/org/apache/avro/ipc/ lang/java/src/java/org/apache/avro/ipc/trace/ lang/java/src/test/java/org/apache/avro/ lang/java/src/test/java/org/apache/avro/ipc/trace/
Date Thu, 26 Aug 2010 00:03:34 GMT
Author: cutting
Date: Thu Aug 26 00:03:34 2010
New Revision: 989408

URL: http://svn.apache.org/viewvc?rev=989408&view=rev
Log:
AVRO-631. Java: Make RPC plugin payload reporting consistent.  Contributed by Patrick Wendell.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/src/java/org/apache/avro/ipc/RPCContext.java
    avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java
    avro/trunk/lang/java/src/java/org/apache/avro/ipc/Responder.java
    avro/trunk/lang/java/src/java/org/apache/avro/ipc/trace/SpanAggregator.java
    avro/trunk/lang/java/src/test/java/org/apache/avro/RPCMetaTestPlugin.java
    avro/trunk/lang/java/src/test/java/org/apache/avro/ipc/trace/TestSpanAggregation.java

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=989408&r1=989407&r2=989408&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Thu Aug 26 00:03:34 2010
@@ -139,6 +139,9 @@ Avro 1.4.0 (unreleased)
     AVRO-598. Java: Use generic data structures when reading with
     reflect API and classes are not defined. (cutting)
 
+    AVRO-631. Java: Make RPC plugin payload reporting consistent.
+    (Patrick Wendell via cutting)
+
   BUG FIXES
 
     AVRO-622. python avro.ipc doesn't work with python2.4 (philz)

Modified: avro/trunk/lang/java/src/java/org/apache/avro/ipc/RPCContext.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/ipc/RPCContext.java?rev=989408&r1=989407&r2=989408&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/ipc/RPCContext.java (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/ipc/RPCContext.java Thu Aug 26 00:03:34
2010
@@ -169,18 +169,18 @@ public class RPCContext {
     this.requestPayload = payload;
   }
  
-  /** Returns the serialized payload of the request in this RPC. Will
-   * not include handshake or meta-data. If the request payload has not been
-   * set yet, returns null.
+  /** Returns the serialized payload of the request in this RPC. Will only be
+   * generated from a Requestor and will not include handshake or meta-data. 
+   * If the request payload has not been set yet, returns null.
    * 
    * @return this RPC's request payload.*/
   public List<ByteBuffer> getRequestPayload() {
     return this.requestPayload;
   }
   
-  /** Returns the serialized payload of the response in this RPC. Will
-   * not include handshake or meta-data. If the response payload has not been
-   * set yet, returns null.
+  /** Returns the serialized payload of the response in this RPC. Will only be
+   * generated from a Responder and will not include handshake or meta-data. 
+   * If the response payload has not been set yet, returns null.
    * 
    * @return this RPC's response payload.*/
   public List<ByteBuffer> getResponsePayload() {

Modified: avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java?rev=989408&r1=989407&r2=989408&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/ipc/Requestor.java Thu Aug 26 00:03:34 2010
@@ -121,7 +121,6 @@ public abstract class Requestor {
         return null;
       } else {                                    // two-way message
         List<ByteBuffer> response = t.transceive(requestBytes);
-        context.setResponsePayload(response);
         ByteBufferInputStream bbi = new ByteBufferInputStream(response);
         in = DecoderFactory.defaultFactory().createBinaryDecoder(bbi, in);
       }

Modified: avro/trunk/lang/java/src/java/org/apache/avro/ipc/Responder.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/ipc/Responder.java?rev=989408&r1=989407&r2=989408&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/ipc/Responder.java (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/ipc/Responder.java Thu Aug 26 00:03:34 2010
@@ -117,7 +117,6 @@ public abstract class Responder {
       
       Object request = readRequest(rm.getRequest(), in);
       
-      context.setRequestPayload(buffers);
       context.setMessage(rm);
       for (RPCPlugin plugin : rpcMetaPlugins) {
         plugin.serverReceiveRequest(context);

Modified: avro/trunk/lang/java/src/java/org/apache/avro/ipc/trace/SpanAggregator.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/ipc/trace/SpanAggregator.java?rev=989408&r1=989407&r2=989408&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/ipc/trace/SpanAggregator.java (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/ipc/trace/SpanAggregator.java Thu Aug 26
00:03:34 2010
@@ -115,6 +115,10 @@ public class SpanAggregator {
             for (TimestampedEvent event: other.events) {
               s.events.add(event);
             }
+            s.requestPayloadSize = Math.max(
+                s.requestPayloadSize, other.requestPayloadSize);
+            s.responsePayloadSize = Math.max(
+                s.responsePayloadSize, other.responsePayloadSize);
             s.complete = true;
             out.completeSpans.add(s);
           }

Modified: avro/trunk/lang/java/src/test/java/org/apache/avro/RPCMetaTestPlugin.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/test/java/org/apache/avro/RPCMetaTestPlugin.java?rev=989408&r1=989407&r2=989408&view=diff
==============================================================================
--- avro/trunk/lang/java/src/test/java/org/apache/avro/RPCMetaTestPlugin.java (original)
+++ avro/trunk/lang/java/src/test/java/org/apache/avro/RPCMetaTestPlugin.java Thu Aug 26 00:03:34
2010
@@ -111,7 +111,6 @@ public final class RPCMetaTestPlugin ext
     
     Assert.assertNotNull(meta);    
     Assert.assertNotNull(context.getMessage());
-    Assert.assertNotNull(context.getRequestPayload());
     Assert.assertNull(context.getResponsePayload());
     
     if (!meta.containsKey(key)) return;
@@ -134,7 +133,6 @@ public final class RPCMetaTestPlugin ext
     Assert.assertNotNull(context.requestCallMeta());
     Assert.assertNotNull(context.responseCallMeta());
 
-    Assert.assertNotNull(context.getRequestPayload());
     Assert.assertNotNull(context.getResponsePayload());
     
     if (!context.requestCallMeta().containsKey(key)) return;
@@ -156,7 +154,6 @@ public final class RPCMetaTestPlugin ext
   public void clientReceiveResponse(RPCContext context) {
     Assert.assertNotNull(context.responseCallMeta());
     Assert.assertNotNull(context.getRequestPayload());
-    Assert.assertNotNull(context.getResponsePayload());
     
     if (!context.responseCallMeta().containsKey(key)) return;
     

Modified: avro/trunk/lang/java/src/test/java/org/apache/avro/ipc/trace/TestSpanAggregation.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/test/java/org/apache/avro/ipc/trace/TestSpanAggregation.java?rev=989408&r1=989407&r2=989408&view=diff
==============================================================================
--- avro/trunk/lang/java/src/test/java/org/apache/avro/ipc/trace/TestSpanAggregation.java
(original)
+++ avro/trunk/lang/java/src/test/java/org/apache/avro/ipc/trace/TestSpanAggregation.java
Thu Aug 26 00:03:34 2010
@@ -46,7 +46,12 @@ public class TestSpanAggregation {
   @Test
   public void testSpanCompletion1() {
     Span span1a = createClientSpan(idValue(1), idValue(1), null, new Utf8("a"));
+    span1a.requestPayloadSize = 10;
+    span1a.responsePayloadSize = 0;
+    
     Span span1b = createServerSpan(idValue(1), idValue(1), null, new Utf8("a"));
+    span1b.requestPayloadSize = 0;
+    span1b.responsePayloadSize = 11;
     
     List<Span> partials = new ArrayList<Span>();
     partials.add(span1a);
@@ -62,6 +67,8 @@ public class TestSpanAggregation {
     assertEquals(null, result.parentSpanID);
     assertTrue(idsEqual(idValue(1), result.spanID));
     assertEquals(4, result.events.size());
+    assertEquals(10, result.requestPayloadSize);
+    assertEquals(11, result.responsePayloadSize);
   }
   
   /**



Mime
View raw message