/** * Ensure that files with insignificant changes are getting promoted if * necessary * */ private synchronized void promoteAgedFiles() { // no need to do this is we aren't prioritizing if (!m_prioritizeSignificantUpdates) return; // the num seconds to update files is 0 then use unfair prioritization if (m_maxInsigUpdateSeconds == 0 || filesWithInsignificantWork.isEmpty()) return; // calculate the elapsed time we first queued updates long now = System.currentTimeMillis(); long elapsedMillis = Math.max(now - getStartTime(), 1); // calculate the milliseconds between promotions necessary to age // insignificant files into // the significant queue double millisPerPromotion = ((m_maxInsigUpdateSeconds * 1000.0) / filesWithInsignificantWork.size()); // calculate the number of millis since start until the next file needs // to be promotoed long nextPromotionMillis = (long) (millisPerPromotion * getPromotionCount()); // if more time has elapsed than the next promotion time then promote a // file if (elapsedMillis > nextPromotionMillis) { String file = filesWithInsignificantWork.removeFirst(); filesWithSignificantWork.addFirst(file); setPromotionCount(getPromotionCount() + 1); } }
/** * Ensure that files with insignificant changes are getting promoted if * necessary * */ private synchronized void promoteAgedFiles() { // no need to do this is we aren't prioritizing if (!m_prioritizeSignificantUpdates) return; // the num seconds to update files is 0 then use unfair prioritization if (m_maxInsigUpdateSeconds == 0 || filesWithInsignificantWork.isEmpty()) return; // calculate the elapsed time we first queued updates long now = System.currentTimeMillis(); long elapsedMillis = Math.max(now - getStartTime(), 1); // calculate the milliseconds between promotions necessary to age // insignificant files into // the significant queue double millisPerPromotion = ((m_maxInsigUpdateSeconds * 1000.0) / filesWithInsignificantWork.size()); // calculate the number of millis since start until the next file needs // to be promotoed long nextPromotionMillis = (long) (millisPerPromotion * getPromotionCount()); // if more time has elapsed than the next promotion time then promote a // file if (elapsedMillis > nextPromotionMillis) { String file = filesWithInsignificantWork.removeFirst(); filesWithSignificantWork.addFirst(file); setPromotionCount(getPromotionCount() + 1); } }