diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java index 28c4c22..bd1e5fd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java @@ -58,12 +58,12 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; * constant-time {@link #cacheBlock} and {@link #getBlock} operations.
*
* Contains three levels of block priority to allow for
- * scan-resistance and in-memory families
+ * scan-resistance and in-memory families
* {@link org.apache.hadoop.hbase.HColumnDescriptor#setInMemory(boolean)} (An
* in-memory column family is a column family that should be served from memory if possible):
* single-access, multiple-accesses, and in-memory priority.
* A block is added with an in-memory priority flag if
- * {@link org.apache.hadoop.hbase.HColumnDescriptor#isInMemory()},
+ * {@link org.apache.hadoop.hbase.HColumnDescriptor#isInMemory()},
* otherwise a block becomes a single access
* priority the first time it is read into this block cache. If a block is accessed again while
* in cache, it is marked as a multiple access priority block. This delineation of blocks is used
@@ -438,6 +438,7 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
@Override
public Cacheable getBlock(BlockCacheKey cacheKey, boolean caching, boolean repeat,
boolean updateCacheMetrics) {
+ updateCacheMetrics = false;
LruCachedBlock cb = map.get(cacheKey);
if (cb == null) {
if (!repeat && updateCacheMetrics) {
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
index 02fe1df..5d95787 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
@@ -568,7 +568,7 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
responseBlockSize += blockSize;
}
- public synchronized void sendResponseIfReady() throws IOException {
+ public void sendResponseIfReady() throws IOException {
this.responder.doRespond(this);
}
@@ -653,7 +653,8 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
private class Reader implements Runnable {
- private volatile boolean adding = false;
+ // Changing adding only under lock. See how it is used below.
+ private boolean adding = false;
private final Selector readSelector;
Reader() throws IOException {
@@ -672,14 +673,15 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
}
}
- private synchronized void doRunLoop() {
+ private void doRunLoop() {
while (running) {
try {
readSelector.select();
- while (adding) {
- this.wait(1000);
+ synchronized (this) {
+ while (adding) {
+ this.wait(0, 1000);
+ }
}
-
Iterator