public void removeInActiveRateValidators(long rateMonitorTimeout) {
log.error("JKUMAR:::::::exectuing remove method"+rateMonitorTimeout+" "+rateValidators.size());
Iterator<RateValidator> iter = rateValidators.values().iterator();
long now = System.currentTimeMillis();
long removed = 0;
try {
while (iter.hasNext()) {
log.error("iterator valuessssssssssssss"+iter.next().toString());
log.error("last update time"+iter.next().getLastUpdate());
RateValidator mtr = iter.next();
log.error("JKUMAR:::::exectuing while loop");
if (now - mtr.getLastUpdate() > rateMonitorTimeout) {
log.error("Executing if condition in while loopt");
iter.remove();
removed++;
}
}
} catch(Exception e) {
log.error("Exception in removeInActiveRateValidators entries::" +e);
}
log.error("JKUMAR:::: after try in remove method");
if (log.isInfoEnabled()) {
log.info("Removed " + removed + " rate monitors, inactive for more than " +
rateMonitorTimeout + " ms");
}
}
i am getting the following error
2017-01-04T05:33:32,469:ERROR:[Timer-optionsmonitor]:OptionsRateMonitor:-:Exception in removeInActiveRateValidators entries::java.lang.ArrayIndexOutOfBoundsException: -1