Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
final List<HyperLogLogPlusCounter> counters = Lists.newArrayList();
ExecutorService service = Executors.newFixedThreadPool(20);
final CountDownLatch latch = new CountDownLatch(20);
for (int i = 0; i < 20; i++) {
service.submit(new Runnable() {
@Override
public void run() {
Random rand = new Random();
HyperLogLogPlusCounter counter = new HyperLogLogPlusCounter(14);
for (long j = 0; j < 500000000; j++) {
if (j % 1000000 == 1)
counter.add("" + rand.nextLong());
}
System.out.println("final" + counter.getCountEstimate());
counters.add(counter);
latch.countDown();
}
});
}
latch.await();
System.out.println("latch done");
HyperLogLogPlusCounter ret = new HyperLogLogPlusCounter(14);
for (HyperLogLogPlusCounter c : counters)
System.out.println(ret.getCountEstimate());
expected output is 10B however the output can be less than 1B