private void cleanUpOldNonces() {
    long cutoff = EnvironmentEdgeManager.currentTime() - deleteNonceGracePeriod;
    for (Map.Entry<NonceKey, OperationContext> entry : nonces.entrySet()) {
      OperationContext oc = entry.getValue();
      if (!oc.isExpired(cutoff)) continue;
      synchronized (oc) {
        if (oc.getState() == OperationContext.WAIT || !oc.isExpired(cutoff)) continue;
        nonces.remove(entry.getKey());
      }
    }
  }
Creates a scheduled chore that is used to clean up old nonces.
@param stoppable Stoppable for the chore.
@return ScheduledChore; the scheduled chore is not started.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ServerNonceManager.java