private static SortedMap<Byte, Set<RawMetricType>> buildBrokerMetricTypesDiffByVersion() { SortedMap<Byte, Set<RawMetricType>> buildBrokerMetricTypesDiffByVersion = new TreeMap<>(); for (RawMetricType type : RawMetricType.values()) { if (type.metricScope() == BROKER) { buildBrokerMetricTypesDiffByVersion.computeIfAbsent(type.supportedVersionSince(), t -> new HashSet<>()).add(type); } } return buildBrokerMetricTypesDiffByVersion; }
/** * Provides the File that is the directory for the index that should be written to. If there is no index yet * to be written to, or if the index has reached its max size, a new one will be created. The given {@code earliestTimestamp} * should represent the event time of the first event that will go into the index. This is used for file naming purposes so * that the appropriate directories can be looked up quickly later. * * @param earliestTimestamp the event time of the first event that will go into a new index, if a new index is created by this call. * @param partitionName the name of the partition to write to * @return the directory that should be written to */ public synchronized File getWritableIndexingDirectory(final long earliestTimestamp, final String partitionName) { IndexLocation indexLoc = activeIndices.get(partitionName); if (indexLoc == null) { indexLoc = new IndexLocation(createIndex(earliestTimestamp, partitionName), earliestTimestamp, partitionName); logger.debug("Created new Index Directory {}", indexLoc); indexLocationByTimestamp.computeIfAbsent(earliestTimestamp, t -> new ArrayList<>()).add(indexLoc); activeIndices.put(partitionName, indexLoc); } return indexLoc.getIndexDirectory(); }
public void addSingleBrokerStats(String host, int id, Broker.State state, double diskUtil, double cpuUtil, double leaderBytesInRate, double followerBytesInRate, double bytesOutRate, double potentialBytesOutRate, int numReplicas, int numLeaders, boolean isEstimated, double capacity) { SingleBrokerStats singleBrokerStats = new SingleBrokerStats(host, id, state, diskUtil, cpuUtil, leaderBytesInRate, followerBytesInRate, bytesOutRate, potentialBytesOutRate, numReplicas, numLeaders, isEstimated, capacity); _brokerStats.add(singleBrokerStats); _hostFieldLength = Math.max(_hostFieldLength, host.length()); _hostStats.computeIfAbsent(host, h -> new BasicStats(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0.0)) .addBasicStats(singleBrokerStats.basicStats()); _isBrokerStatsEstimated = _isBrokerStatsEstimated || isEstimated; }
Comparable rankingWeight = benchmarkReport.getSolverRankingWeightFactory() .createRankingWeight(rankableSolverBenchmarkResultList, solverBenchmarkResult); List<SolverBenchmarkResult> sameRankingList = rankedMap.computeIfAbsent(rankingWeight, k -> new ArrayList<>()); sameRankingList.add(solverBenchmarkResult);
final List<IndexLocation> dirsForTimestamp = indexLocationByTimestamp.computeIfAbsent(startTime, t -> new ArrayList<>()); final IndexLocation indexLoc = new IndexLocation(indexDir, startTime, partitionName); dirsForTimestamp.add(indexLoc);
running.computeIfAbsent(dataSource, k -> new TreeMap<>()) .computeIfAbsent(interval.getStart(), k -> new TreeMap<>(Comparators.intervalsByStartThenEnd())) .computeIfAbsent(interval, k -> new ArrayList<>()) .add(posseToUse);
private SortedMap<DruidServer, List<SegmentDescriptor>> groupSegmentsByServer(Set<ServerToSegment> segments) { final SortedMap<DruidServer, List<SegmentDescriptor>> serverSegments = new TreeMap<>(); for (ServerToSegment serverToSegment : segments) { final QueryableDruidServer queryableDruidServer = serverToSegment.getServer().pick(); if (queryableDruidServer == null) { log.makeAlert( "No servers found for SegmentDescriptor[%s] for DataSource[%s]?! How can this be?!", serverToSegment.getSegmentDescriptor(), query.getDataSource() ).emit(); } else { final DruidServer server = queryableDruidServer.getServer(); serverSegments.computeIfAbsent(server, s -> new ArrayList<>()).add(serverToSegment.getSegmentDescriptor()); } } return serverSegments; }
private static SortedMap<Long,List<Long>> rangeOf( Labels[] data, long rangeId ) { SortedMap<Long,List<Long>> result = new TreeMap<>(); for ( Labels label : data ) { for ( Pair<LabelScanKey,LabelScanValue> entry : label.entries ) { if ( entry.first().idRange == rangeId ) { long baseNodeId = entry.first().idRange * RANGE_SIZE; long bits = entry.other().bits; while ( bits != 0 ) { long nodeId = baseNodeId + Long.numberOfTrailingZeros( bits ); result.computeIfAbsent( nodeId, id -> new ArrayList<>() ).add( (long) label.labelId ); bits &= bits - 1; } } } } return result.isEmpty() ? null : result; }
pending = new TreeMap<>() ; MvccTxEntry prev = pending.computeIfAbsent(batchNum, k -> new LinkedHashMap<>()).put(key, e);
@Override public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException { if (!enabled) { return getExtent().setBlock(location, block); } BlockVector2 chunkPos = BlockVector2.at(location.getBlockX() >> 4, location.getBlockZ() >> 4); batches.computeIfAbsent(chunkPos, k -> new LocatedBlockList()).add(location, block); return true; }
private static NavigableMap<byte[], SortedMap<byte[], Set<Long>>> breakUpTimestampsByRow(Result<? extends Record> records) { NavigableMap<byte[], SortedMap<byte[], Set<Long>>> ret = Maps.newTreeMap(UnsignedBytes.lexicographicalComparator()); for (Record record : records) { byte[] row = record.getValue(A_ROW_NAME); byte[] col = record.getValue(A_COL_NAME); SortedMap<byte[], Set<Long>> colMap = ret.computeIfAbsent(row, rowName -> Maps.newTreeMap(UnsignedBytes.lexicographicalComparator())); Set<Long> tsSet = colMap.computeIfAbsent(col, ts -> Sets.newHashSet()); tsSet.add(record.getValue(A_TIMESTAMP)); } return ret; }
mapping.computeIfAbsent(keyExtent, k -> new Files()) .add(new FileInfo(fileName, estSize, 0));
Map<KeyExtent,Bulk.FileInfo> pathMapping = future.get(); pathMapping.forEach((extent, path) -> { mappings.computeIfAbsent(extent, k -> new Bulk.Files()).add(path); }); } catch (InterruptedException e) {
public void addIntersection(String node1, String node2, PrefixSpace intersection) { SortedMap<String, PrefixSpace> intersections = _intersections.computeIfAbsent(node1, k -> new TreeMap<>()); intersections.put(node2, intersection); }
public void add(String hostname, Prefix prefix, String interfaceName, Ip address) { SortedMap<Prefix, SortedSet<InterfaceIpPair>> prefixMap = _selfAdjacencies.computeIfAbsent(hostname, k -> new TreeMap<>()); SortedSet<InterfaceIpPair> interfaces = prefixMap.computeIfAbsent(prefix, k -> new TreeSet<>()); interfaces.add(new InterfaceIpPair(interfaceName, address)); }
public void referenceStructure(StructureType type, String name, StructureUsage usage, int line) { SortedMap<String, SortedMap<StructureUsage, SortedMultiset<Integer>>> byName = _structureReferences.computeIfAbsent(type, k -> new TreeMap<>()); SortedMap<StructureUsage, SortedMultiset<Integer>> byUsage = byName.computeIfAbsent(name, k -> new TreeMap<>()); SortedMultiset<Integer> lines = byUsage.computeIfAbsent(usage, k -> TreeMultiset.create()); lines.add(line); }
private void addToDeadlines(K key, long deadline) { if (deadlineToKeys.computeIfAbsent(deadline, x -> new HashSet<>()).add(key)) { lazyIncrement(totalWindows); } }
@Override public void enterClb_rule(Clb_ruleContext ctx) { String name = ctx.rulenum.getText(); _configuration .getCf() .getCable() .getDocsisPolicyRules() .computeIfAbsent(name, DocsisPolicyRule::new); defineStructure(DOCSIS_POLICY_RULE, name, ctx); }
@Override public void enterS_depi_tunnel(S_depi_tunnelContext ctx) { String name = ctx.name.getText(); _configuration.getCf().getDepiTunnels().computeIfAbsent(name, DepiTunnel::new); defineStructure(DEPI_TUNNEL, name, ctx); }
@Override public void enterS_service_group(S_service_groupContext ctx) { String name = getText(ctx.name); _currentServiceGroup = _currentVsys.getServiceGroups().computeIfAbsent(name, ServiceGroup::new); // Use constructed service-group name so same-named defs across vsys are unique String uniqueName = computeObjectName(_currentVsys.getName(), name); defineStructure(SERVICE_GROUP, uniqueName, ctx); }