HBASE-10097 Remove a region name string creation in HRegion#nextInternal

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1548711 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
nkeywal 2013-12-06 20:07:25 +00:00
parent 5748f08ea0
commit bad7aa2d99
3 changed files with 16 additions and 11 deletions

View File

@ -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

View File

@ -474,14 +474,11 @@ public class RpcServer implements RpcServerInterface {
}
@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;
}
}

View File

@ -109,6 +109,7 @@ import org.apache.hadoop.hbase.io.HeapSize;
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 { // , Writable{
// 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.