/** * We need to track which files are being processed by which threads so that * we don't try to process updates for the same file on more than one * thread. */ private synchronized void storeAssignment(Operation op) { // look and see if there a pending ops list for this file LinkedList<Operation> pendingOperations = pendingFileOperations.get(op.getFileName()); // if not then we create an ops list for the file and add the file to // the work items list if (pendingOperations == null) { pendingOperations = new LinkedList<Operation>(); pendingFileOperations.put(op.getFileName(), pendingOperations); // add the file to the correct list based on what type of work we // are adding. (if we aren't prioritizing then every file is counted as // signficant if (!m_prioritizeSignificantUpdates || op.isSignificant()) filesWithSignificantWork.addLast(op.getFileName()); else filesWithInsignificantWork.addLast(op.getFileName()); } else if (m_prioritizeSignificantUpdates && op.isSignificant() && hasOnlyInsignificant(pendingOperations)) { // only do this when we are prioritizing as this bumps files from inSig // up to insig // promote the file to the significant list if this is the first // significant filesWithSignificantWork.addLast(op.getFileName()); } promoteAgedFiles(); op.addToPendingList(pendingOperations); }
/** * We need to track which files are being processed by which threads so that * we don't try to process updates for the same file on more than one * thread. */ private synchronized void storeAssignment(Operation op) { // look and see if there a pending ops list for this file LinkedList<Operation> pendingOperations = pendingFileOperations.get(op.getFileName()); // if not then we create an ops list for the file and add the file to // the work items list if (pendingOperations == null) { pendingOperations = new LinkedList<Operation>(); pendingFileOperations.put(op.getFileName(), pendingOperations); // add the file to the correct list based on what type of work we // are adding. (if we aren't prioritizing then every file is counted as // signficant if (!m_prioritizeSignificantUpdates || op.isSignificant()) filesWithSignificantWork.addLast(op.getFileName()); else filesWithInsignificantWork.addLast(op.getFileName()); } else if (m_prioritizeSignificantUpdates && op.isSignificant() && hasOnlyInsignificant(pendingOperations)) { // only do this when we are prioritizing as this bumps files from inSig // up to insig // promote the file to the significant list if this is the first // significant filesWithSignificantWork.addLast(op.getFileName()); } promoteAgedFiles(); op.addToPendingList(pendingOperations); }