@Override
    public synchronized long getCount() {
        return eventCount;
    }
@Test
    void testConcurrentAccess() throws Exception {
        final ThresholdMeter thresholdMeter = new ThresholdMeter(THRESHOLD_LARGE, INTERVAL);
        final int repeatNum = 100;
        final int concurrency = 2;

        final List<Thread> threads = new ArrayList<>();

        threads.addAll(
                getConcurrentThreads(repeat(thresholdMeter::markEvent, repeatNum), concurrency));
        threads.addAll(
                getConcurrentThreads(repeat(thresholdMeter::getRate, repeatNum), concurrency));
        threads.addAll(
                getConcurrentThreads(
                        repeat(thresholdMeter::checkAgainstThreshold, repeatNum), concurrency));

        for (Thread thread : threads) {
            thread.start();
        }

        for (Thread thread : threads) {
            thread.join();
        }

        assertThat(thresholdMeter.getCount()).isEqualTo(repeatNum * concurrency);
    }