avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r894922 - in /hadoop/avro/trunk: CHANGES.txt src/java/org/apache/avro/ipc/RPCContext.java src/java/org/apache/avro/ipc/Requestor.java src/java/org/apache/avro/ipc/Responder.java src/test/java/org/apache/avro/RPCMetaTestPlugin.java
Date Thu, 31 Dec 2009 18:41:16 GMT
Author: cutting
Date: Thu Dec 31 18:41:15 2009
New Revision: 894922

URL: http://svn.apache.org/viewvc?rev=894922&view=rev
Log:
AVRO-272.  Extend RPCContext to include message.  Contributed by Philip Zeyliger.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/src/java/org/apache/avro/ipc/RPCContext.java
    hadoop/avro/trunk/src/java/org/apache/avro/ipc/Requestor.java
    hadoop/avro/trunk/src/java/org/apache/avro/ipc/Responder.java
    hadoop/avro/trunk/src/test/java/org/apache/avro/RPCMetaTestPlugin.java

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=894922&r1=894921&r2=894922&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Thu Dec 31 18:41:15 2009
@@ -38,6 +38,10 @@
       - tojson  Dumps an Avro data file as JSON, one record per line.
       - fragtojson Renders a binary-encoded Avro datum as JSON.
       - jsontofrag Renders a JSON-encoded Avro datum as binary.
+    (Philip Zeyliger via cutting)
+
+    AVRO-272. Extend RPCContext to include message. 
+    (Philip Zeyliger via cutting)
 
   IMPROVEMENTS
 

Modified: hadoop/avro/trunk/src/java/org/apache/avro/ipc/RPCContext.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/java/org/apache/avro/ipc/RPCContext.java?rev=894922&r1=894921&r2=894922&view=diff
==============================================================================
--- hadoop/avro/trunk/src/java/org/apache/avro/ipc/RPCContext.java (original)
+++ hadoop/avro/trunk/src/java/org/apache/avro/ipc/RPCContext.java Thu Dec 31 18:41:15 2009
@@ -21,6 +21,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.avro.Protocol.Message;
 import org.apache.avro.util.Utf8;
 
 /**
@@ -37,6 +38,7 @@
   
   protected Object response;
   protected AvroRemoteException error;
+  private Message message;
   
   /**
    * This is an access method for the handshake state
@@ -146,4 +148,10 @@
   public boolean isError() {
     return error != null;
   }
+
+  public void setMessage(Message message) {
+    this.message = message;    
+  }
+  
+  public Message getMessage() { return message; }
 }

Modified: hadoop/avro/trunk/src/java/org/apache/avro/ipc/Requestor.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/java/org/apache/avro/ipc/Requestor.java?rev=894922&r1=894921&r2=894922&view=diff
==============================================================================
--- hadoop/avro/trunk/src/java/org/apache/avro/ipc/Requestor.java (original)
+++ hadoop/avro/trunk/src/java/org/apache/avro/ipc/Requestor.java Thu Dec 31 18:41:15 2009
@@ -97,6 +97,7 @@
       m = getLocal().getMessages().get(messageName);
       if (m == null)
         throw new AvroRuntimeException("Not a local message: "+messageName);
+      context.setMessage(m);
       
       for (RPCPlugin plugin : rpcMetaPlugins) {
         plugin.clientSendRequest(context);

Modified: hadoop/avro/trunk/src/java/org/apache/avro/ipc/Responder.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/java/org/apache/avro/ipc/Responder.java?rev=894922&r1=894921&r2=894922&view=diff
==============================================================================
--- hadoop/avro/trunk/src/java/org/apache/avro/ipc/Responder.java (original)
+++ hadoop/avro/trunk/src/java/org/apache/avro/ipc/Responder.java Thu Dec 31 18:41:15 2009
@@ -102,6 +102,8 @@
       if (m == null)
         throw new AvroRuntimeException("No such remote message: "+messageName);
       
+      context.setMessage(m);
+      
       Object request = readRequest(m.getRequest(), in);
       
       for (RPCPlugin plugin : rpcMetaPlugins) {

Modified: hadoop/avro/trunk/src/test/java/org/apache/avro/RPCMetaTestPlugin.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/test/java/org/apache/avro/RPCMetaTestPlugin.java?rev=894922&r1=894921&r2=894922&view=diff
==============================================================================
--- hadoop/avro/trunk/src/test/java/org/apache/avro/RPCMetaTestPlugin.java (original)
+++ hadoop/avro/trunk/src/test/java/org/apache/avro/RPCMetaTestPlugin.java Thu Dec 31 18:41:15
2009
@@ -95,6 +95,7 @@
   public void clientSendRequest(RPCContext context) { 
     ByteBuffer buf = ByteBuffer.wrap("ap".getBytes());
     context.requestCallMeta().put(key, buf);
+    Assert.assertNotNull(context.getMessage());
   }
   
   @Override
@@ -116,6 +117,8 @@
     buf = ByteBuffer.wrap((partialstr + "a").getBytes());
     Assert.assertTrue(buf.remaining() > 0);
     meta.put(key, buf);
+    
+    Assert.assertNotNull(context.getMessage());
   }
   
   @Override



Mime
View raw message