You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2012/04/21 03:32:08 UTC
svn commit: r1328561 -
/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
Author: mbautin
Date: Sat Apr 21 01:32:07 2012
New Revision: 1328561
URL: http://svn.apache.org/viewvc?rev=1328561&view=rev
Log:
[jira] [HBASE-3508] [89-fb] LruBlockCache statistics thread should have a name
Summary:
Pulling in the small patch from trunk: HBASE-3508.
Original description below.
Currently it's just an unnamed threadpool. It's annoying.
Test Plan: Run a minicluster unit test in a debugger. Ensure that the cache
stats thread has a name.
Reviewers: liyintang, kannan, aaiyer, todd
Reviewed By: liyintang
Differential Revision: https://reviews.facebook.net/D2853
Modified:
hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java?rev=1328561&r1=1328560&r2=1328561&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java Sat Apr 21 01:32:07 2012
@@ -49,6 +49,8 @@ import org.apache.hadoop.hbase.util.Byte
import org.apache.hadoop.hbase.util.ClassSize;
import org.apache.hadoop.hbase.util.FSUtils;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
/**
* A block cache implementation that is memory-aware using {@link HeapSize},
* memory-bound using an LRU eviction algorithm, and concurrent: backed by a
@@ -123,7 +125,11 @@ public class LruBlockCache implements Bl
/** Statistics thread schedule pool (for heavy debugging, could remove) */
private final ScheduledExecutorService scheduleThreadPool =
- Executors.newScheduledThreadPool(1);
+ Executors.newScheduledThreadPool(1,
+ new ThreadFactoryBuilder()
+ .setNameFormat("LRU Statistics #%d")
+ .setDaemon(true)
+ .build());
/** Current size of cache */
private final AtomicLong size;
@@ -619,17 +625,16 @@ public class LruBlockCache implements Bl
}
}
- /*
+ /**
* Statistics thread. Periodically prints the cache statistics to the log.
*/
- private static class StatisticsThread extends Thread {
+ private static class StatisticsThread implements Runnable {
LruBlockCache lru;
public StatisticsThread(LruBlockCache lru) {
- super("LruBlockCache.StatisticsThread");
- setDaemon(true);
this.lru = lru;
}
+
@Override
public void run() {
lru.logStats();