hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject svn commit: r1548713 - in /hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase: ipc/RpcCallContext.java ipc/RpcServer.java regionserver/HRegion.java
Date Fri, 06 Dec 2013 20:17:30 GMT
Author: nkeywal
Date: Fri Dec  6 20:17:30 2013
New Revision: 1548713

URL: http://svn.apache.org/r1548713
Log:
HBASE-10097 Remove a region name string creation in HRegion#nextInternal

Modified:
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java?rev=1548713&r1=1548712&r2=1548713&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcCallContext.java
Fri Dec  6 20:17:30 2013
@@ -20,11 +20,12 @@ package org.apache.hadoop.hbase.ipc;
 
 public interface RpcCallContext extends Delayable {
   /**
-   * Throw an exception if the caller who made this IPC call has disconnected.
+   * Check if the caller who made this IPC call has disconnected.
    * If called from outside the context of IPC, this does nothing.
-   * @throws CallerDisconnectedException
+   * @return < 0 if the caller is still connected. The time in ms
+   *  since the disconnection otherwise
    */
-  void throwExceptionIfCallerDisconnected(String regionName) throws CallerDisconnectedException;
+  long disconnectSince();
 
   /**
    * If the client connected and specified a codec to use, then we will use this codec making

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java?rev=1548713&r1=1548712&r2=1548713&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
Fri Dec  6 20:17:30 2013
@@ -474,14 +474,11 @@ public class RpcServer implements RpcSer
     }
 
     @Override
-    public void throwExceptionIfCallerDisconnected(String regionName)
-        throws CallerDisconnectedException {
+    public long disconnectSince() {
       if (!connection.channel.isOpen()) {
-        long afterTime = System.currentTimeMillis() - timestamp;
-        throw new CallerDisconnectedException(
-            "Aborting on region " + regionName + ", call " +
-             this + " after " + afterTime + " ms, since " +
-             "caller disconnected");
+        return System.currentTimeMillis() - timestamp;
+      } else {
+        return -1L;
       }
     }
 

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1548713&r1=1548712&r2=1548713&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Fri Dec  6 20:17:30 2013
@@ -109,6 +109,7 @@ import org.apache.hadoop.hbase.io.HeapSi
 import org.apache.hadoop.hbase.io.TimeRange;
 import org.apache.hadoop.hbase.io.hfile.BlockCache;
 import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.ipc.CallerDisconnectedException;
 import org.apache.hadoop.hbase.ipc.RpcCallContext;
 import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.master.AssignmentManager;
@@ -3745,7 +3746,13 @@ public class HRegion implements HeapSize
           // client might time out and disconnect while the server side
           // is still processing the request. We should abort aggressively
           // in that case.
-          rpcCall.throwExceptionIfCallerDisconnected(getRegionNameAsString());
+          long afterTime = rpcCall.disconnectSince();
+          if (afterTime >= 0) {
+            throw new CallerDisconnectedException(
+                "Aborting on region " + getRegionNameAsString() + ", call " +
+                    this + " after " + afterTime + " ms, since " +
+                    "caller disconnected");
+          }
         }
 
         // Let's see what we have in the storeHeap.



Mime
View raw message