Source:
<code>public void run() { while (running) { long now = System.currentTimeMillis(); checkLowReplication(now); boolean periodic = (now - this.lastRollTime) > this.rollPeriod; if (periodic) { LOG.debug("WAL roll period ms elapsed", this.rollPeriod); } else { synchronized (this) { if (walNeedsRoll.values().stream().anyMatch(Boolean::booleanValue)) { LOG.debug("WAL roll requested"); } else { try { wait(this.threadWakeFrequency); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } continue; } } } try { this.lastRollTime = System.currentTimeMillis(); for (Iterator<Entry<WAL, Boolean>> iter = walNeedsRoll.entrySet().iterator(); iter .hasNext();) { Entry<WAL, Boolean> entry = iter.next(); <START> if (!periodic && !entry.getValue()) { <END> continue; } WAL wal = entry.getKey(); entry.setValue(Boolean.FALSE); Map<byte[], List<byte[]>> regionsToFlush = null; try { regionsToFlush = wal.rollWriter(true); } catch (WALClosedException e) { LOG.warn("WAL has been closed. Skipping rolling of writer and just remove it", e); iter.remove(); } if (regionsToFlush != null) { for (Map.Entry<byte[], List<byte[]>> r : regionsToFlush.entrySet()) { scheduleFlush(Bytes.toString(r.getKey()), r.getValue()); } } afterRoll(wal); } } catch (FailedLogCloseException | ConnectException e) { abort("Failed log close in log roller", e); } catch (IOException ex) { abort("IOE in log roller", ex instanceof RemoteException ? ((RemoteException) ex).unwrapRemoteException() : ex); } catch (Exception ex) { LOG.error("Log rolling failed", ex); abort("Log rolling failed", ex); } } LOG.info("LogRoller exiting."); }</code><technical_language>actual fix is this right</technical_language>

Target:
public void run() { while (running) { long now = System.currentTimeMillis(); checkLowReplication(now); synchronized (this) { if (wals.values().stream().noneMatch(rc -> rc.needsRoll(now))) { try { wait(this.threadWakeFrequency); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } continue; } } try { for (Iterator<Entry<WAL, RollController>> iter = wals.entrySet().iterator(); iter.hasNext();) { Entry<WAL, RollController> entry = iter.next(); WAL wal = entry.getKey(); RollController controller = entry.getValue(); if (controller.isRollRequested()) { LOG.debug("WAL roll requested", wal); } else if (controller.needsPeriodicRoll(now)){ LOG.debug("WAL roll period ms elapsed", wal, this.rollPeriod); } else { continue; } try { Map<byte[], List<byte[]>> regionsToFlush = controller.rollWal(now); if (regionsToFlush != null) { for (Map.Entry<byte[], List<byte[]>> r : regionsToFlush.entrySet()) { scheduleFlush(Bytes.toString(r.getKey()), r.getValue()); } } } catch (WALClosedException e) { LOG.warn("WAL has been closed. Skipping rolling of writer and just remove it", e); iter.remove(); } afterRoll(wal); } } catch (FailedLogCloseException | ConnectException e) { abort("Failed log close in log roller", e); } catch (IOException ex) { abort("IOE in log roller", ex instanceof RemoteException ? ((RemoteException) ex).unwrapRemoteException() : ex); } catch (Exception ex) { LOG.error("Log rolling failed", ex); abort("Log rolling failed", ex); } } LOG.info("LogRoller exiting."); }