hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1430677 [2/2] - in /hbase/trunk: hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/ hbase-protocol/src/main/protobuf/ hbase-server/src/main/java/org/apache/hadoop/hbase/ hbase-server/src/main/java/org/apache/hadoop/hb...
Date Wed, 09 Jan 2013 04:23:03 GMT
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ProtobufRpcServerEngine.java
Wed Jan  9 04:23:02 2013
@@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.IpcProtocol;
 import org.apache.hadoop.hbase.client.Operation;
 import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
@@ -56,10 +57,10 @@ class ProtobufRpcServerEngine implements
   }
 
   @Override
-  public Server getServer(Class<? extends VersionedProtocol> protocol,
-                          Object instance, Class<?>[] ifaces, String bindAddress, int
port,
-                          int numHandlers, int metaHandlerCount, boolean verbose,
-                          Configuration conf, int highPriorityLevel) throws IOException {
+  public Server getServer(Object instance, Class<?>[] ifaces,
+      String bindAddress, int port, int numHandlers, int metaHandlerCount,
+      boolean verbose, Configuration conf, int highPriorityLevel)
+  throws IOException {
     return new Server(instance, ifaces, conf, bindAddress, port, numHandlers,
         metaHandlerCount, verbose, highPriorityLevel);
   }
@@ -78,9 +79,6 @@ class ProtobufRpcServerEngine implements
     private static final int DEFAULT_WARN_RESPONSE_TIME = 10000; // milliseconds
     private static final int DEFAULT_WARN_RESPONSE_SIZE = 100 * 1024 * 1024;
 
-    /** Names for suffixed metrics */
-    private static final String ABOVE_ONE_SEC_METRIC = ".aboveOneSec.";
-
     private final int warnResponseTime;
     private final int warnResponseSize;
 
@@ -153,9 +151,9 @@ class ProtobufRpcServerEngine implements
      * the return response has protobuf response payload. On failure, the
      * exception name and the stack trace are returned in the protobuf response.
      */
-    public Message call(Class<? extends VersionedProtocol> protocol,
-                        RpcRequestBody rpcRequest, long receiveTime, MonitoredRPCHandler
status)
-        throws IOException {
+    public Message call(Class<? extends IpcProtocol> protocol,
+      RpcRequestBody rpcRequest, long receiveTime, MonitoredRPCHandler status)
+    throws IOException {
       try {
         String methodName = rpcRequest.getMethodName();
         Method method = getMethod(protocol, methodName);
@@ -170,13 +168,6 @@ class ProtobufRpcServerEngine implements
          * The rpcProxy's has a declared protocol name that is
          * sent form client to server at connection time.
          */
-        //TODO: use the clientVersion to do protocol compatibility checks, and
-        //this could be used here to handle complex use cases like deciding
-        //which implementation of the protocol should be used to service the
-        //current request, etc. Ideally, we shouldn't land up in a situation
-        //where we need to support such a use case.
-        //For now the clientVersion field is simply ignored
-        long clientVersion = rpcRequest.getClientProtocolVersion();
 
         if (verbose) {
           LOG.info("Call: protocol name=" + protocol.getName() +
@@ -243,7 +234,6 @@ class ProtobufRpcServerEngine implements
           buffer.append("(");
           buffer.append(param.getClass().getName());
           buffer.append(")");
-          buffer.append(", client version="+clientVersion);
           logResponse(new Object[]{rpcRequest.getRequest()},
               methodName, buffer.toString(), (tooLarge ? "TooLarge" : "TooSlow"),
               status.getClient(), startTime, processingTime, qTime,
@@ -271,7 +261,7 @@ class ProtobufRpcServerEngine implements
       }
     }
 
-    static Method getMethod(Class<? extends VersionedProtocol> protocol,
+    static Method getMethod(Class<? extends IpcProtocol> protocol,
                             String methodName) {
       Method method = methodInstances.get(methodName);
       if (method != null) {
@@ -377,4 +367,4 @@ class ProtobufRpcServerEngine implements
       LOG.info(v);
     }
   }
-}
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java
Wed Jan  9 04:23:02 2013
@@ -21,6 +21,7 @@
 package org.apache.hadoop.hbase.ipc;
 
 import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.hbase.IpcProtocol;
 import org.apache.hadoop.hbase.security.User;
 
 import java.net.InetAddress;
@@ -90,7 +91,7 @@ public class RequestContext {
    */
   public static void set(User user,
       InetAddress remoteAddress,
-      Class<? extends VersionedProtocol> protocol) {
+      Class<? extends IpcProtocol> protocol) {
     RequestContext ctx = instance.get();
     ctx.user = user;
     ctx.remoteAddress = remoteAddress;
@@ -111,12 +112,12 @@ public class RequestContext {
 
   private User user;
   private InetAddress remoteAddress;
-  private Class<? extends VersionedProtocol> protocol;
+  private Class<? extends IpcProtocol> protocol;
   // indicates we're within a RPC request invocation
   private boolean inRequest;
 
   private RequestContext(User user, InetAddress remoteAddr,
-      Class<? extends VersionedProtocol> protocol) {
+      Class<? extends IpcProtocol> protocol) {
     this.user = user;
     this.remoteAddress = remoteAddr;
     this.protocol = protocol;
@@ -130,11 +131,11 @@ public class RequestContext {
     return remoteAddress;
   }
 
-  public Class<? extends VersionedProtocol> getProtocol() {
+  public Class<? extends IpcProtocol> getProtocol() {
     return protocol;
   }
 
   public boolean isInRequest() {
     return inRequest;
   }
-}
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientEngine.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientEngine.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientEngine.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientEngine.java
Wed Jan  9 04:23:02 2013
@@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.ipc;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.IpcProtocol;
 import org.apache.hadoop.hbase.security.User;
 
 import javax.net.SocketFactory;
@@ -31,12 +32,10 @@ import java.net.InetSocketAddress;
 @InterfaceAudience.Private
 public interface RpcClientEngine {
   /** Construct a client-side proxy object. */
-  VersionedProtocol getProxy(Class<? extends VersionedProtocol> protocol,
-                             long clientVersion, InetSocketAddress addr,
-                             User ticket, Configuration conf,
-                             SocketFactory factory, int rpcTimeout) throws IOException;
+  IpcProtocol getProxy(Class<? extends IpcProtocol> protocol,
+    InetSocketAddress addr, User ticket, Configuration conf,
+    SocketFactory factory, int rpcTimeout) throws IOException;
 
   /** Stop this proxy. */
-  void stopProxy(VersionedProtocol proxy);
-
-}
+  void stopProxy(IpcProtocol proxy);
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java Wed
Jan  9 04:23:02 2013
@@ -23,16 +23,18 @@ import com.google.common.base.Function;
 import com.google.protobuf.Message;
 
 import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.hbase.IpcProtocol;
 import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
 import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcRequestBody;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
 
-/**
- */
 @InterfaceAudience.Private
 public interface RpcServer {
+  // TODO: Needs cleanup.  Why a 'start', and then a 'startThreads' and an 'openServer'?
+  // Also, the call takes a RpcRequestBody, an already composed combination of
+  // rpc Request and metadata.  Should disentangle metadata and rpc Request Message.
 
   void setSocketSendBufSize(int size);
 
@@ -45,12 +47,12 @@ public interface RpcServer {
   InetSocketAddress getListenerAddress();
 
   /** Called for each call.
-   * @param param writable parameter
+   * @param param parameter
    * @param receiveTime time
-   * @return Message
+   * @return Message Protobuf response Message
    * @throws java.io.IOException e
    */
-  Message call(Class<? extends VersionedProtocol> protocol,
+  Message call(Class<? extends IpcProtocol> protocol,
       RpcRequestBody param, long receiveTime, MonitoredRPCHandler status)
       throws IOException;
 
@@ -62,9 +64,8 @@ public interface RpcServer {
 
   void startThreads();
 
-
   /**
    * Returns the metrics instance for reporting RPC call statistics
    */
   MetricsHBaseServer getMetrics();
-}
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerEngine.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerEngine.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerEngine.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServerEngine.java
Wed Jan  9 04:23:02 2013
@@ -26,11 +26,9 @@ import java.io.IOException;
 /** An RPC implementation for the server. */
 @InterfaceAudience.Private
 interface RpcServerEngine {
-
   /** Construct a server for a protocol implementation instance. */
-  RpcServer getServer(Class<? extends VersionedProtocol> protocol, Object instance,
-                       Class<?>[] ifaces, String bindAddress,
-                       int port, int numHandlers, int metaHandlerCount,
-                       boolean verbose, Configuration conf, int highPriorityLevel)
-      throws IOException;
-}
+  RpcServer getServer(Object instance, Class<?>[] protocols,
+    String bindAddress, int port, int numHandlers, int metaHandlerCount,
+    boolean verbose, Configuration conf, int highPriorityLevel)
+  throws IOException;
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Wed
Jan  9 04:23:02 2013
@@ -81,7 +81,6 @@ import org.apache.hadoop.hbase.executor.
 import org.apache.hadoop.hbase.executor.ExecutorService.ExecutorType;
 import org.apache.hadoop.hbase.ipc.HBaseServer;
 import org.apache.hadoop.hbase.ipc.HBaseServerRPC;
-import org.apache.hadoop.hbase.ipc.ProtocolSignature;
 import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.ipc.ServerRpcController;
 import org.apache.hadoop.hbase.ipc.UnknownProtocolException;
@@ -966,33 +965,6 @@ Server {
   }
 
   @Override
-  public ProtocolSignature getProtocolSignature(
-      String protocol, long version, int clientMethodsHashCode)
-  throws IOException {
-    if (MasterMonitorProtocol.class.getName().equals(protocol)) {
-      return new ProtocolSignature(MasterMonitorProtocol.VERSION, null);
-    } else if (MasterAdminProtocol.class.getName().equals(protocol)) {
-      return new ProtocolSignature(MasterAdminProtocol.VERSION, null);
-    } else if (RegionServerStatusProtocol.class.getName().equals(protocol)) {
-      return new ProtocolSignature(RegionServerStatusProtocol.VERSION, null);
-    }
-    throw new IOException("Unknown protocol: " + protocol);
-  }
-
-  public long getProtocolVersion(String protocol, long clientVersion) {
-    if (MasterMonitorProtocol.class.getName().equals(protocol)) {
-      return MasterMonitorProtocol.VERSION;
-    } else if (MasterAdminProtocol.class.getName().equals(protocol)) {
-      return MasterAdminProtocol.VERSION;
-    } else if (RegionServerStatusProtocol.class.getName().equals(protocol)) {
-      return RegionServerStatusProtocol.VERSION;
-    }
-    // unknown protocol
-    LOG.warn("Version requested for unimplemented protocol: "+protocol);
-    return -1;
-  }
-
-  @Override
   public TableDescriptors getTableDescriptors() {
     return this.tableDescriptors;
   }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Wed Jan  9 04:23:02 2013
@@ -106,7 +106,6 @@ import org.apache.hadoop.hbase.io.hfile.
 import org.apache.hadoop.hbase.ipc.HBaseClientRPC;
 import org.apache.hadoop.hbase.ipc.HBaseRPCErrorHandler;
 import org.apache.hadoop.hbase.ipc.HBaseServerRPC;
-import org.apache.hadoop.hbase.ipc.ProtocolSignature;
 import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
 import org.apache.hadoop.hbase.ipc.ServerRpcController;
@@ -1794,7 +1793,7 @@ public class  HRegionServer implements C
         // Do initial RPC setup. The final argument indicates that the RPC
         // should retry indefinitely.
         master = (RegionServerStatusProtocol) HBaseClientRPC.waitForProxy(
-            RegionServerStatusProtocol.class, RegionServerStatusProtocol.VERSION,
+            RegionServerStatusProtocol.class,
             isa, this.conf, -1,
             this.rpcTimeout, this.rpcTimeout);
         LOG.info("Connected to master at " + isa);
@@ -2043,31 +2042,6 @@ public class  HRegionServer implements C
   }
 
   @Override
-  @QosPriority(priority=HConstants.HIGH_QOS)
-  public ProtocolSignature getProtocolSignature(
-      String protocol, long version, int clientMethodsHashCode)
-  throws IOException {
-    if (protocol.equals(ClientProtocol.class.getName())) {
-      return new ProtocolSignature(ClientProtocol.VERSION, null);
-    } else if (protocol.equals(AdminProtocol.class.getName())) {
-      return new ProtocolSignature(AdminProtocol.VERSION, null);
-    }
-    throw new IOException("Unknown protocol: " + protocol);
-  }
-
-  @Override
-  @QosPriority(priority=HConstants.HIGH_QOS)
-  public long getProtocolVersion(final String protocol, final long clientVersion)
-  throws IOException {
-    if (protocol.equals(ClientProtocol.class.getName())) {
-      return ClientProtocol.VERSION;
-    } else if (protocol.equals(AdminProtocol.class.getName())) {
-      return AdminProtocol.VERSION;
-    }
-    throw new IOException("Unknown protocol: " + protocol);
-  }
-
-  @Override
   public Leases getLeases() {
     return leases;
   }

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
Wed Jan  9 04:23:02 2013
@@ -383,7 +383,7 @@ public class HBaseTestingUtility extends
     //file system, the tests should use getBaseTestDir, otherwise, we can use
     //the working directory, and create a unique sub dir there
     FileSystem fs = getTestFileSystem();
-    if (fs.getUri().getScheme().equals(fs.getLocal(conf).getUri().getScheme())) {
+    if (fs.getUri().getScheme().equals(FileSystem.getLocal(conf).getUri().getScheme())) {
       File dataTestDir = new File(getDataTestDir().toString());
       dataTestDirOnTestFS = new Path(dataTestDir.getAbsolutePath());
     } else {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/RandomTimeoutRpcEngine.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/RandomTimeoutRpcEngine.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/RandomTimeoutRpcEngine.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/RandomTimeoutRpcEngine.java
Wed Jan  9 04:23:02 2013
@@ -29,9 +29,9 @@ import java.net.SocketTimeoutException;
 import java.util.Random;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.hadoop.hbase.ipc.VersionedProtocol;
 import javax.net.SocketFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.IpcProtocol;
 import org.apache.hadoop.hbase.security.User;
 
 import com.google.protobuf.ServiceException;
@@ -47,18 +47,18 @@ public class RandomTimeoutRpcEngine exte
   public static double chanceOfTimeout = 0.3;
   private static AtomicInteger invokations = new AtomicInteger();
   
-  public VersionedProtocol getProxy(
-      Class<? extends VersionedProtocol> protocol, long clientVersion,
+  public IpcProtocol getProxy(
+      Class<? extends IpcProtocol> protocol,
       InetSocketAddress addr, User ticket,
       Configuration conf, SocketFactory factory, int rpcTimeout) throws IOException {
     // Start up the requested-for proxy so we can pass-through calls to the underlying
     // RpcEngine.  Also instantiate and return our own proxy (RandomTimeoutInvocationHandler)
     // that will either throw exceptions or pass through to the underlying proxy.
-    VersionedProtocol actualProxy = super.getProxy(protocol, clientVersion, addr,
+    IpcProtocol actualProxy = super.getProxy(protocol, addr,
       ticket, conf, factory, rpcTimeout);
     RandomTimeoutInvocationHandler invoker =
       new RandomTimeoutInvocationHandler(actualProxy);
-    VersionedProtocol object = (VersionedProtocol)Proxy.newProxyInstance(
+    IpcProtocol object = (IpcProtocol)Proxy.newProxyInstance(
       protocol.getClassLoader(), new Class[]{protocol}, invoker);
     return object;
   }
@@ -66,7 +66,8 @@ public class RandomTimeoutRpcEngine exte
   /**
    * Call this in order to set this class to run as the RpcEngine for the given protocol
    */
-  public static void setProtocolEngine(Configuration conf, Class protocol) {
+  public static void setProtocolEngine(Configuration conf,
+      Class<? extends IpcProtocol> protocol) {
     HBaseClientRPC.setProtocolEngine(conf, protocol, RandomTimeoutRpcEngine.class);
   }
 
@@ -78,9 +79,9 @@ public class RandomTimeoutRpcEngine exte
   }
 
   static class RandomTimeoutInvocationHandler implements InvocationHandler {
-    private VersionedProtocol actual = null;
+    private IpcProtocol actual = null;
 
-    public RandomTimeoutInvocationHandler(VersionedProtocol actual) {
+    public RandomTimeoutInvocationHandler(IpcProtocol actual) {
       this.actual = actual;
     }
 
@@ -96,4 +97,4 @@ public class RandomTimeoutRpcEngine exte
       return Proxy.getInvocationHandler(actual).invoke(proxy, method, args);
     }
   }
-}
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestDelayedRpc.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestDelayedRpc.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestDelayedRpc.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestDelayedRpc.java
Wed Jan  9 04:23:02 2013
@@ -24,22 +24,20 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
-import java.lang.reflect.Method;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.Assert;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.*;
-import org.apache.hadoop.hbase.ipc.VersionedProtocol;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.IpcProtocol;
+import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.ipc.protobuf.generated.TestDelayedRpcProtos.TestArg;
 import org.apache.hadoop.hbase.ipc.protobuf.generated.TestDelayedRpcProtos.TestResponse;
-import org.apache.hadoop.hbase.MediumTests;
 import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.Level;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.mortbay.log.Log;
@@ -69,13 +67,13 @@ public class TestDelayedRpc {
   private void testDelayedRpc(boolean delayReturnValue) throws Exception {
     Configuration conf = HBaseConfiguration.create();
     InetSocketAddress isa = new InetSocketAddress("localhost", 0);
-
-    rpcServer = HBaseServerRPC.getServer(new TestRpcImpl(delayReturnValue),
+    TestRpcImpl instance = new TestRpcImpl(delayReturnValue);
+    rpcServer = HBaseServerRPC.getServer(instance.getClass(), instance,
         new Class<?>[]{ TestRpcImpl.class },
         isa.getHostName(), isa.getPort(), 1, 0, true, conf, 0);
     rpcServer.start();
 
-    TestRpc client = (TestRpc) HBaseClientRPC.getProxy(TestRpc.class, 0,
+    TestRpc client = (TestRpc) HBaseClientRPC.getProxy(TestRpc.class,
         rpcServer.getListenerAddress(), conf, 1000);
 
     List<Integer> results = new ArrayList<Integer>();
@@ -133,11 +131,12 @@ public class TestDelayedRpc {
     log.setLevel(Level.WARN);
 
     InetSocketAddress isa = new InetSocketAddress("localhost", 0);
-    rpcServer = HBaseServerRPC.getServer(new TestRpcImpl(true),
+    TestRpcImpl instance = new TestRpcImpl(true);
+    rpcServer = HBaseServerRPC.getServer(instance.getClass(), instance,
         new Class<?>[]{ TestRpcImpl.class },
         isa.getHostName(), isa.getPort(), 1, 0, true, conf, 0);
     rpcServer.start();
-    TestRpc client = (TestRpc) HBaseClientRPC.getProxy(TestRpc.class, 0,
+    TestRpc client = (TestRpc) HBaseClientRPC.getProxy(TestRpc.class,
         rpcServer.getListenerAddress(), conf, 1000);
 
     Thread threads[] = new Thread[MAX_DELAYED_RPC + 1];
@@ -165,8 +164,7 @@ public class TestDelayedRpc {
     log.removeAppender(listAppender);
   }
 
-  public interface TestRpc extends VersionedProtocol {
-    public static final long VERSION = 1L;
+  public interface TestRpc extends IpcProtocol {
     TestResponse test(TestArg delay);
   }
 
@@ -213,22 +211,6 @@ public class TestDelayedRpc {
       responseBuilder.setResponse(0xDEADBEEF);
       return responseBuilder.build();
     }
-
-    @Override
-    public long getProtocolVersion(String arg0, long arg1) throws IOException {
-      return 0;
-    }
-
-    @Override
-    public ProtocolSignature getProtocolSignature(String protocol,
-        long clientVersion, int clientMethodsHash) throws IOException {
-      Method [] methods = this.getClass().getMethods();
-      int [] hashes = new int [methods.length];
-      for (int i = 0; i < methods.length; i++) {
-        hashes[i] = methods[i].hashCode();
-      }
-      return new ProtocolSignature(clientVersion, hashes);
-    }
   }
 
   private static class TestThread extends Thread {
@@ -263,13 +245,13 @@ public class TestDelayedRpc {
   public void testEndDelayThrowing() throws IOException {
     Configuration conf = HBaseConfiguration.create();
     InetSocketAddress isa = new InetSocketAddress("localhost", 0);
-
-    rpcServer = HBaseServerRPC.getServer(new FaultyTestRpc(),
+    FaultyTestRpc instance = new FaultyTestRpc();
+    rpcServer = HBaseServerRPC.getServer(instance.getClass(), instance,
         new Class<?>[]{ TestRpcImpl.class },
         isa.getHostName(), isa.getPort(), 1, 0, true, conf, 0);
     rpcServer.start();
 
-    TestRpc client = (TestRpc) HBaseClientRPC.getProxy(TestRpc.class, 0,
+    TestRpc client = (TestRpc) HBaseClientRPC.getProxy(TestRpc.class,
         rpcServer.getListenerAddress(), conf, 1000);
 
     int result = 0xDEADBEEF;
@@ -312,18 +294,5 @@ public class TestDelayedRpc {
       // Client will receive the Exception, not this value.
       return TestResponse.newBuilder().setResponse(DELAYED).build();
     }
-
-    @Override
-    public long getProtocolVersion(String arg0, long arg1) throws IOException {
-      return 0;
-    }
-
-    @Override
-    public ProtocolSignature getProtocolSignature(String protocol,
-        long clientVersion, int clientMethodsHash) throws IOException {
-      return new ProtocolSignature(clientVersion, new int [] {});
-    }
   }
-
-}
-
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestIPC.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestIPC.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestIPC.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestIPC.java Wed Jan
 9 04:23:02 2013
@@ -18,41 +18,40 @@
   */
 package org.apache.hadoop.hbase.ipc;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.spy;
+
 import java.io.IOException;
-import java.net.Socket;
 import java.net.InetSocketAddress;
-import java.net.SocketTimeoutException;
+import java.net.Socket;
+
 import javax.net.SocketFactory;
-import java.lang.reflect.Method;
-import java.util.*;
 
-import static org.junit.Assert.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.IpcProtocol;
+import org.apache.hadoop.hbase.SmallTests;
+import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
+import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcRequestBody;
+import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.util.StringUtils;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-
-import static org.mockito.Mockito.*;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
-import org.apache.hadoop.hbase.SmallTests;
-
-import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RpcRequestBody;
 import com.google.protobuf.Message;
-import org.apache.hadoop.hbase.security.User;
-
-import org.apache.commons.logging.*;
-import org.apache.log4j.Logger;
 
 @Category(SmallTests.class)
 public class TestIPC {
   public static final Log LOG = LogFactory.getLog(TestIPC.class);
-  private static final Random RANDOM = new Random();
 
   private static class TestRpcServer extends HBaseServer {
     TestRpcServer() throws IOException {
@@ -60,11 +59,10 @@ public class TestIPC {
     }
 
     @Override
-    public Message call(Class<? extends VersionedProtocol> protocol,
-        RpcRequestBody rpcRequest, 
-        long receiveTime, 
-        MonitoredRPCHandler status) throws IOException {
-      return rpcRequest;
+    public Message call(Class<? extends IpcProtocol> protocol,
+        RpcRequestBody param, long receiveTime, MonitoredRPCHandler status)
+    throws IOException {
+      return param;
     }
   }
 
@@ -97,4 +95,4 @@ public class TestIPC {
       assertTrue(StringUtils.stringifyException(e).contains("Injected fault"));
     }
   }
-}
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestProtoBufRpc.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestProtoBufRpc.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestProtoBufRpc.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestProtoBufRpc.java
Wed Jan  9 04:23:02 2013
@@ -22,6 +22,7 @@ import java.net.InetSocketAddress;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.IpcProtocol;
 import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos.EchoRequestProto;
 import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos.EchoResponseProto;
 import org.apache.hadoop.hbase.ipc.protobuf.generated.TestProtos.EmptyRequestProto;
@@ -52,7 +53,7 @@ public class TestProtoBufRpc {
   private static RpcServer server;
 
   public interface TestRpcService
-      extends TestProtobufRpcProto.BlockingInterface, VersionedProtocol {
+      extends TestProtobufRpcProto.BlockingInterface, IpcProtocol {
     public long VERSION = 1;
   }
 
@@ -76,20 +77,6 @@ public class TestProtoBufRpc {
         EmptyRequestProto request) throws ServiceException {
       throw new ServiceException("error", new IOException("error"));
     }
-
-    @Override
-    public long getProtocolVersion(String protocol, long clientVersion)
-        throws IOException {
-      // TODO Auto-generated method stub
-      return 0;
-    }
-
-    @Override
-    public ProtocolSignature getProtocolSignature(String protocol,
-        long clientVersion, int clientMethodsHash) throws IOException {
-      // TODO Auto-generated method stub
-      return null;
-    }
   }
 
   @Before
@@ -120,7 +107,7 @@ public class TestProtoBufRpc {
     HBaseClientRPC.setProtocolEngine(conf, TestRpcService.class, ProtobufRpcClientEngine.class);
     HBaseServerRPC.setProtocolEngine(conf, TestRpcService.class, ProtobufRpcServerEngine.class);
 
-    return (TestRpcService) HBaseClientRPC.getProxy(TestRpcService.class, 0,
+    return (TestRpcService) HBaseClientRPC.getProxy(TestRpcService.class,
         addr, conf, 10000);
   }
 
@@ -149,4 +136,4 @@ public class TestProtoBufRpc {
     } catch (ServiceException e) {
     }
   }
-}
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java
Wed Jan  9 04:23:02 2013
@@ -36,7 +36,6 @@ import org.apache.hadoop.hbase.client.Cl
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.ipc.ProtocolSignature;
 import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.CloseRegionRequest;
@@ -187,20 +186,6 @@ class MockRegionServer implements AdminP
   }
 
   @Override
-  public long getProtocolVersion(String protocol, long clientVersion)
-      throws IOException {
-    // TODO Auto-generated method stub
-    return 0;
-  }
-
-  @Override
-  public ProtocolSignature getProtocolSignature(String protocol,
-      long clientVersion, int clientMethodsHash) throws IOException {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Override
   public boolean isStopped() {
     // TODO Auto-generated method stub
     return false;

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java
Wed Jan  9 04:23:02 2013
@@ -56,7 +56,7 @@ public class TestHMasterRPCException {
     while (i < 20) { 
       try {
         MasterMonitorProtocol inf = (MasterMonitorProtocol) HBaseClientRPC.getProxy(
-            MasterMonitorProtocol.class, MasterMonitorProtocol.VERSION, isa, conf, 100 *
10);
+            MasterMonitorProtocol.class, isa, conf, 100 * 10);
         inf.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
         fail();
       } catch (ServiceException ex) {
@@ -77,6 +77,4 @@ public class TestHMasterRPCException {
     }
     fail();
   }
-
-}
-
+}
\ No newline at end of file

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java
Wed Jan  9 04:23:02 2013
@@ -32,6 +32,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterId;
+import org.apache.hadoop.hbase.IpcProtocol;
 import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
@@ -45,11 +46,9 @@ import org.apache.hadoop.hbase.ipc.Block
 import org.apache.hadoop.hbase.ipc.HBaseClientRPC;
 import org.apache.hadoop.hbase.ipc.HBaseServer;
 import org.apache.hadoop.hbase.ipc.HBaseServerRPC;
-import org.apache.hadoop.hbase.ipc.ProtocolSignature;
 import org.apache.hadoop.hbase.ipc.RequestContext;
 import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.ipc.ServerRpcController;
-import org.apache.hadoop.hbase.ipc.VersionedProtocol;
 import org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.RegionServerServices;
@@ -86,8 +85,7 @@ public class TestTokenAuthentication {
       serverPrincipal = "hbase.test.kerberos.principal")
   @TokenInfo("HBASE_AUTH_TOKEN")
   private static interface BlockingAuthenticationService
-      extends AuthenticationProtos.AuthenticationService.BlockingInterface, VersionedProtocol
{
-    long VERSION = 1L;
+  extends AuthenticationProtos.AuthenticationService.BlockingInterface, IpcProtocol {
   }
 
   /**
@@ -292,17 +290,6 @@ public class TestTokenAuthentication {
         throw new ServiceException(ioe);
       }
     }
-
-    /* VersionedProtocol implementation */
-    @Override
-    public long getProtocolVersion(String protocol, long clientVersion) throws IOException
{
-      return BlockingAuthenticationService.VERSION;
-    }
-
-    @Override
-    public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int
clientMethodsHash) throws IOException {
-      return new ProtocolSignature(BlockingAuthenticationService.VERSION, null);
-    }
   }
 
 
@@ -365,7 +352,7 @@ public class TestTokenAuthentication {
     testuser.setAuthenticationMethod(
         UserGroupInformation.AuthenticationMethod.TOKEN);
     final Configuration conf = TEST_UTIL.getConfiguration();
-    testuser.setConfiguration(conf);
+    UserGroupInformation.setConfiguration(conf);
     Token<AuthenticationTokenIdentifier> token =
         secretManager.generateToken("testuser");
     LOG.debug("Got token: " + token.toString());
@@ -379,7 +366,6 @@ public class TestTokenAuthentication {
         AuthenticationProtos.AuthenticationService.BlockingInterface proxy =
             (AuthenticationProtos.AuthenticationService.BlockingInterface)
             HBaseClientRPC.waitForProxy(BlockingAuthenticationService.class,
-                BlockingAuthenticationService.VERSION,
                 server.getAddress(), c,
                 HConstants.DEFAULT_HBASE_CLIENT_RPC_MAXATTEMPTS,
                 HConstants.DEFAULT_HBASE_RPC_TIMEOUT,

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockRegionServerServices.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockRegionServerServices.java?rev=1430677&r1=1430676&r2=1430677&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockRegionServerServices.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MockRegionServerServices.java
Wed Jan  9 04:23:02 2013
@@ -170,4 +170,4 @@ public class MockRegionServerServices im
   public Leases getLeases() {
     return null;
   }
-}
+}
\ No newline at end of file



Mime
View raw message