@Test public void testPersistentThrowsError() throws IOException { final Error error = new Error("expected error"); doThrow(error).when(persistentManager).freezeAllFilters(bloomFilterManager); filterUpdateTimesCounter.add(100); assertThatThrownBy(() -> job.run()).isSameAs(error); assertThat(filterUpdateTimesCounter.sum()).isZero(); verify(persistentManager, times(1)).freezeAllFilters(bloomFilterManager); }
@Override public void run() { synchronized (filterUpdateTimesCounter) { final long sum = filterUpdateTimesCounter.sum(); if (sum > criteria.updatesThreshold()) { if (logger.isDebugEnabled()) { logger.debug("Updated {} times in last {} seconds meets threshold {} to persistence filters", sum, criteria.checkingPeriod().getSeconds(), criteria.updatesThreshold()); } filterUpdateTimesCounter.reset(); doPersistence(); } } }
PersistentFiltersJob implements Runnable { @Override public void run() { synchronized (filterUpdateTimesCounter) { final long sum = filterUpdateTimesCounter.sum(); if (sum > criteria.updatesThreshold()) { if (logger.isDebugEnabled()) { logger.debug("Updated {} times in last {} seconds meets threshold {} to persistence filters", sum, criteria.checkingPeriod().getSeconds(), criteria.updatesThreshold()); } filterUpdateTimesCounter.reset(); doPersistence(); } } } }
PersistentFiltersJob implements Runnable { @Override public void run() { synchronized (filterUpdateTimesCounter) { final long sum = filterUpdateTimesCounter.sum(); if (sum > criteria.updatesThreshold()) { if (logger.isDebugEnabled()) { logger.debug("Updated {} times in last {} seconds meets threshold {} to persistence filters", sum, criteria.checkingPeriod().getSeconds(), criteria.updatesThreshold()); } filterUpdateTimesCounter.reset(); doPersistence(); } } } PersistentFiltersJob(BloomFilterManager<F, ?> bloomFilterManager,
                         PersistentManager<F> persistentManager,
                         LongAdder filterUpdateTimesCounter,
                         TriggerPersistenceCriteria criteria); }
PersistentFiltersJob implements Runnable { @Override public void run() { synchronized (filterUpdateTimesCounter) { final long sum = filterUpdateTimesCounter.sum(); if (sum > criteria.updatesThreshold()) { if (logger.isDebugEnabled()) { logger.debug("Updated {} times in last {} seconds meets threshold {} to persistence filters", sum, criteria.checkingPeriod().getSeconds(), criteria.updatesThreshold()); } filterUpdateTimesCounter.reset(); doPersistence(); } } } PersistentFiltersJob(BloomFilterManager<F, ?> bloomFilterManager,
                         PersistentManager<F> persistentManager,
                         LongAdder filterUpdateTimesCounter,
                         TriggerPersistenceCriteria criteria); @Override void run(); }
PersistentFiltersJob implements Runnable { @Override public void run() { synchronized (filterUpdateTimesCounter) { final long sum = filterUpdateTimesCounter.sum(); if (sum > criteria.updatesThreshold()) { if (logger.isDebugEnabled()) { logger.debug("Updated {} times in last {} seconds meets threshold {} to persistence filters", sum, criteria.checkingPeriod().getSeconds(), criteria.updatesThreshold()); } filterUpdateTimesCounter.reset(); doPersistence(); } } } PersistentFiltersJob(BloomFilterManager<F, ?> bloomFilterManager,
                         PersistentManager<F> persistentManager,
                         LongAdder filterUpdateTimesCounter,
                         TriggerPersistenceCriteria criteria); @Override void run();  }