  @Test
  public void testTagsetsConcurrent() throws InterruptedException {

    DistributionBucket bucket = new DistributionBucket(new long[]{0, 10, 100});
    final BasicHistogramAggregator table = new BasicHistogramAggregator("test", bucket, 128);
    final Object lock = new Object();
    synchronized (table) {
      new Thread(() -> {
        for (int i = 0; i < 64; i++) {
          table.apply(new String[]{"testTag", String.valueOf(i)}, 1, CURRENT_TIME);
        }
        synchronized (lock) {
          lock.notify();
        }
        for (int i = 64; i < 128; i++) {
          table.apply(new String[]{"testTag", String.valueOf(i)}, 1, CURRENT_TIME);
        }
      }).start();
      synchronized (lock) {
        lock.wait(500L);
      }
      Thread.sleep(100L);
      for (int i = 0; i < 128; i++) {
        table.apply(new String[]{"testTag", String.valueOf(i)}, 1, CURRENT_TIME);
      }
    }
    assertEquals(128, table.size());
  }