Refine search
private static boolean removeFromRunningTaskMap(TreeMap<Integer, TreeSet<TaskInfo>> runningTasks, Object task, TaskInfo taskInfo) { int priority = taskInfo.priority.getPriority(); Set<TaskInfo> tasksAtPriority = runningTasks.get(priority); if (tasksAtPriority == null) return false; boolean result = tasksAtPriority.remove(taskInfo); if (tasksAtPriority.isEmpty()) { runningTasks.remove(priority); } return result; }
this.shortLengths.put(i, edge); } else { this.lengths.put(i, edge); this.lengths.remove(e.getId()); } else { Edge e0 = triangle.getEdges().get(0); && e1.getOV().isBorder() && e1.getEV().isBorder()) { this.shortLengths.put(e.getId(), e); this.lengths.remove(e.getId()); } else { this.lengths.put(eC.getId(), eC); this.lengths.remove(eA.getId()); } else if (eB.isBorder()) { this.edges.remove(eB.getId()); this.lengths.put(eC.getId(), eC); this.lengths.remove(eB.getId()); } else { this.edges.remove(eC.getId()); this.lengths.put(eB.getId(), eB); this.lengths.remove(eC.getId());
if (name.split("\\.").length == size && name.startsWith(prefix)) { Optional<String> columnName = Optional.of(name.substring(name.lastIndexOf('.') + 1)); Type columnType = fieldsMap.get(name); Field column = new Field(columnName, columnType); fieldsBuilder.add(column); fieldsMap.put(prefix, RowType.from(fieldsBuilder.build())); columns.add(new ElasticsearchColumn(field, type, field, type.getDisplayName(), arrays.contains(field), -1)); fieldsMap.remove(field);
/** * Inserts the specified key-value pair into the symbol table, overwriting the old * value with the new value if the symbol table already contains the specified key. * Deletes the specified key (and its associated value) from this symbol table * if the specified value is {@code null}. * * @param key the key * @param val the value * @throws IllegalArgumentException if {@code key} is {@code null} */ public void put(Key key, Value val) { if (key == null) throw new IllegalArgumentException("calls put() with null key"); if (val == null) st.remove(key); else st.put(key, val); }
return false; tmpSize -= this.workUnitsMap.get(existingFileSet).size(); partitionsToDelete.add(existingFileSet); if (tmpSize + workUnits.size() <= this.strictMaxSize) { List<WorkUnit> workUnitsRemoved = this.workUnitsMap.remove(fileSetToRemove); this.currentSize -= workUnitsRemoved.size(); this.workUnitsMap.put(fileSet, workUnits); } else { this.workUnitsMap.get(fileSet).addAll(workUnits);
@Override public void resumeFromBlacklist() { Set<String> readyToRemove = new HashSet<>(); for (Map.Entry<String, Integer> entry : blacklist.entrySet()) { String key = entry.getKey(); int value = entry.getValue() - 1; if (value == 0) { readyToRemove.add(key); } else { blacklist.put(key, value); } } for (String key : readyToRemove) { blacklist.remove(key); LOG.info("Supervisor {} has been blacklisted more than resume period. Removed from blacklist.", key); } }
/** */ private synchronized void onQueryDone(UUID nodeId, Long ver) { TreeMap<Long, AtomicInteger> nodeMap = activeQueries.get(nodeId); if (nodeMap == null) return; assert minQry != null; AtomicInteger cntr = nodeMap.get(ver); assert cntr != null && cntr.get() > 0 : "onQueryDone ver=" + ver; if (cntr.decrementAndGet() == 0) { nodeMap.remove(ver); if (nodeMap.isEmpty()) activeQueries.remove(nodeId); if (ver.equals(minQry)) minQry = activeMinimal(); } }
ImmutablePair<String, Object> groupKeyResultPair = new ImmutablePair<>(groupKey, result); List<ImmutablePair<String, Object>> groupKeyResultPairs = _treeMap.get(newKey); if (_numValuesAdded >= _trimSize) { _treeMap.put(newKey, groupKeyResultPairs); _treeMap.remove(maxKey); _treeMap.put(newKey, groupKeyResultPairs);
public void makeMessageToCosumeAgain(List<MessageExt> msgs) { try { this.lockTreeMap.writeLock().lockInterruptibly(); try { for (MessageExt msg : msgs) { this.consumingMsgOrderlyTreeMap.remove(msg.getQueueOffset()); this.msgTreeMap.put(msg.getQueueOffset(), msg); } } finally { this.lockTreeMap.writeLock().unlock(); } } catch (InterruptedException e) { log.error("makeMessageToCosumeAgain exception", e); } }
/** * Remove a relationship by its ID. * * @param id * The relationship ID to remove. */ public void removeRelationship(String id) { PackageRelationship rel = relationshipsByID.get(id); if (rel != null) { relationshipsByID.remove(rel.getId()); relationshipsByType.values().remove(rel); internalRelationshipsByTargetName.values().remove(rel); } }
assert(prob >= 0 && prob <= 1) : "prob is not inside [0,1]: " + prob; if (prob_idx.containsKey(prob)) { prob_idx.get(prob).add(label); //add all ties } else { List<Integer> li = new LinkedList<Integer>(); li.add(label); prob_idx.put(prob, li); prob_idx.remove(prob_idx.lastKey()); prob_idx.remove(prob);
LOG.debug("supervisorsWithFailures : {}", supervisorsWithFailures); reporter.reportBlacklist(supervisor, supervisorsWithFailures); blacklist.put(supervisor, resumeTime / nimbusMonitorFreqSecs); LOG.debug("Releasing {} nodes because of low resources", toRelease.size()); for (String key: toRelease) { blacklist.remove(key);
void remove(int key, int value) { GHIntHashSet set = map.get(value); if (set == null || !set.remove(key)) { throw new IllegalStateException("cannot remove key " + key + " with value " + value + " - did you insert " + key + "," + value + " before?"); } size--; if (set.isEmpty()) { map.remove(value); } }
@Override public void moveTo(FilePath newName, boolean atomicReplace) { synchronized (MEMORY_FILES) { if (!atomicReplace && !name.equals(newName.name) && MEMORY_FILES.containsKey(newName.name)) { throw DbException.get(ErrorCode.FILE_RENAME_FAILED_2, name, newName + " (exists)"); } FileNioMemData f = getMemoryFile(); f.setName(newName.name); MEMORY_FILES.remove(name); MEMORY_FILES.put(newName.name, f); } }
private void flushOneRow() throws IOException { Integer firstRowNum = _rows.firstKey(); if (firstRowNum!=null) { int rowIndex = firstRowNum.intValue(); SXSSFRow row = _rows.get(firstRowNum); // Update the best fit column widths for auto-sizing just before the rows are flushed _autoSizeColumnTracker.updateColumnWidths(row); _writer.writeRow(rowIndex, row); _rows.remove(firstRowNum); lastFlushedRowNumber = rowIndex; } } public void changeRowNum(SXSSFRow row, int newRowNum)