hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1382206 - in /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase: client/coprocessor/Exec.java ipc/Invocation.java ipc/WritableRpcEngine.java
Date Fri, 07 Sep 2012 23:20:07 GMT
Author: stack
Date: Fri Sep  7 23:20:07 2012
New Revision: 1382206

URL: http://svn.apache.org/viewvc?rev=1382206&view=rev
Log:
HBASE-6340 HBase RPC should allow protocol extension with common interfaces.

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/Exec.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/Exec.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/Exec.java?rev=1382206&r1=1382205&r2=1382206&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/Exec.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/client/coprocessor/Exec.java
Fri Sep  7 23:20:07 2012
@@ -64,7 +64,7 @@ public class Exec extends Invocation imp
       byte[] row,
       Class<? extends CoprocessorProtocol> protocol,
       Method method, Object[] parameters) {
-    super(method, parameters);
+    super(method, protocol, parameters);
     this.conf = configuration;
     this.referenceRow = row;
     this.protocol = protocol;

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java?rev=1382206&r1=1382205&r2=1382206&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/Invocation.java Fri Sep
 7 23:20:07 2012
@@ -45,26 +45,27 @@ public class Invocation extends Versione
 
   public Invocation() {}
 
-  public Invocation(Method method, Object[] parameters) {
+  public Invocation(Method method,
+      Class<? extends VersionedProtocol> declaringClass, Object[] parameters) {
     this.methodName = method.getName();
     this.parameterClasses = method.getParameterTypes();
     this.parameters = parameters;
-    if (method.getDeclaringClass().equals(VersionedProtocol.class)) {
+    if (declaringClass.equals(VersionedProtocol.class)) {
       //VersionedProtocol is exempted from version check.
       clientVersion = 0;
       clientMethodsHash = 0;
     } else {
       try {
-        Field versionField = method.getDeclaringClass().getField("VERSION");
+        Field versionField = declaringClass.getField("VERSION");
         versionField.setAccessible(true);
-        this.clientVersion = versionField.getLong(method.getDeclaringClass());
+        this.clientVersion = versionField.getLong(declaringClass);
       } catch (NoSuchFieldException ex) {
-        throw new RuntimeException("The " + method.getDeclaringClass(), ex);
+        throw new RuntimeException("The " + declaringClass, ex);
       } catch (IllegalAccessException ex) {
         throw new RuntimeException(ex);
       }
-      this.clientMethodsHash = ProtocolSignature.getFingerprint(method
-          .getDeclaringClass().getMethods());
+      this.clientMethodsHash = ProtocolSignature.getFingerprint(
+          declaringClass.getMethods());
     }
   }
 
@@ -169,4 +170,4 @@ public class Invocation extends Versione
   public byte getVersion() {
     return RPC_VERSION;
   }
-}
\ No newline at end of file
+}

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java?rev=1382206&r1=1382205&r2=1382206&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/ipc/WritableRpcEngine.java Fri
Sep  7 23:20:07 2012
@@ -148,7 +148,7 @@ class WritableRpcEngine implements RpcEn
       }
 
       HbaseObjectWritable value = (HbaseObjectWritable)
-        client.call(new Invocation(method, args), address,
+        client.call(new Invocation(method, protocol, args), address,
                     protocol, ticket, rpcTimeout);
       if (logDebug) {
         // FIGURE HOW TO TURN THIS OFF!
@@ -210,7 +210,7 @@ class WritableRpcEngine implements RpcEn
 
     Invocation[] invocations = new Invocation[params.length];
     for (int i = 0; i < params.length; i++)
-      invocations[i] = new Invocation(method, params[i]);
+      invocations[i] = new Invocation(method, protocol, params[i]);
     HBaseClient client = CLIENTS.getClient(conf);
     try {
     Writable[] wrappedValues =



Mime
View raw message