/** * Check if too many error has been occurred. If the half of total transaction is error for the * last 10 secs. It notifies the {@link ConsoleShutdownListener} * * @param cumulativeStatistics accumulated Statistics */ private void checkTooManyError(StatisticsSet cumulativeStatistics) { StatisticsIndexMap statisticsIndexMap = getStatisticsIndexMap(); long testSum = cumulativeStatistics.getCount(statisticsIndexMap.getLongSampleIndex("timedTests")); long errors = cumulativeStatistics.getValue(statisticsIndexMap.getLongIndex("errors")); if (((double) (testSum + errors)) / 2 < errors) { if (lastMomentWhenErrorsMoreThanHalfOfTotalTPSValue == 0) { lastMomentWhenErrorsMoreThanHalfOfTotalTPSValue = System.currentTimeMillis(); } else if (isOverLowTpsThreshhold()) { LOGGER.warn( "Stop the test because the count of test error is more than" + " half of total tps for last {} seconds.", TOO_MANY_ERROR_TIME / 1000); getListeners() .apply( new Informer<ConsoleShutdownListener>() { public void inform(ConsoleShutdownListener listener) { listener.readyToStop(StopReason.TOO_MANY_ERRORS); } }); lastMomentWhenErrorsMoreThanHalfOfTotalTPSValue = 0; } } }