You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2019/12/05 04:23:00 UTC

[GitHub] [hbase] lhofhansl commented on a change in pull request #755: HBASE-23210 Backport HBASE-15519 (Add per-user metrics) to branch-1

lhofhansl commented on a change in pull request #755: HBASE-23210 Backport HBASE-15519 (Add per-user metrics) to branch-1
URL: https://github.com/apache/hbase/pull/755#discussion_r354105610
 
 

 ##########
 File path: hbase-server/src/main/java/org/apache/hadoop/hbase/util/LossyCounting.java
 ##########
 @@ -39,35 +46,41 @@
  */
 
 @InterfaceAudience.Private
-public class LossyCounting {
+public class LossyCounting<T> {
+  private static final Logger LOG = LoggerFactory.getLogger(LossyCounting.class);
+  private final ExecutorService executor;
   private long bucketSize;
   private int currentTerm;
-  private Map<String, Integer> data;
+  private Map<T, Integer> data;
   private long totalDataCount;
+  private final String name;
   private LossyCountingListener listener;
+  private static AtomicReference<Future> fut = new AtomicReference<>(null);
 
-  public interface LossyCountingListener {
-    void sweep(String key);
+  public interface LossyCountingListener<T> {
+    void sweep(T key);
   }
 
-  public LossyCounting(double errorRate, LossyCountingListener listener) {
+  public LossyCounting(double errorRate, String name, LossyCountingListener listener) {
     if (errorRate < 0.0 || errorRate > 1.0) {
       throw new IllegalArgumentException(" Lossy Counting error rate should be within range [0,1]");
     }
+    this.name = name;
     this.bucketSize = (long) Math.ceil(1 / errorRate);
     this.currentTerm = 1;
     this.totalDataCount = 0;
     this.data = new ConcurrentHashMap<>();
     this.listener = listener;
     calculateCurrentTerm();
+    executor = Executors.newSingleThreadExecutor();
 
 Review comment:
   I think this causes the RegionServer process to hang upon shutdown since we're not using daemon threads.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services