java.util.concurrent.ConcurrentSkipListMap.keySet()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中java.util.concurrent.ConcurrentSkipListMap.keySet()方法的一些代码示例,展示了ConcurrentSkipListMap.keySet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListMap.keySet()方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListMap
类名称:ConcurrentSkipListMap
方法名:keySet

ConcurrentSkipListMap.keySet介绍

[英]Lazily initialized key set
[中]延迟初始化密钥集

代码示例

代码示例来源:origin: apache/incubator-druid

@Override
public Set<DataSegment> getSegmentsToDrop()
{
 return Collections.unmodifiableSet(segmentsToDrop.keySet());
}

代码示例来源:origin: apache/incubator-druid

@JsonProperty
@Override
public Set<DataSegment> getSegmentsToLoad()
{
 return segmentsToLoad.keySet();
}

代码示例来源:origin: apache/incubator-druid

@Override
public Set<DataSegment> getSegmentsToLoad()
{
 return Collections.unmodifiableSet(segmentsToLoad.keySet());
}

代码示例来源:origin: apache/incubator-druid

@JsonProperty
@Override
public Set<DataSegment> getSegmentsToDrop()
{
 return segmentsToDrop.keySet();
}

代码示例来源:origin: twitter/distributedlog

@VisibleForTesting
Set<URI> getSubnamespaces() {
  return subNamespaces.keySet();
}

代码示例来源:origin: twitter/distributedlog

Future<Set<URI>> getCachedSubNamespaces() {
  Set<URI> nsSet = subNamespaces.keySet();
  return Future.value(nsSet);
}

代码示例来源:origin: apache/geode

@Override
public CloseableIterator<CachedDeserializable> keyIterator() {
 return new ItrAdapter(map.keySet().iterator());
}

代码示例来源:origin: alibaba/jstorm

private void rescale(long now, long next) {
  if (nextScaleTime.compareAndSet(next, now + RESCALE_THRESHOLD)) {
    lockForRescale();
    try {
      final long oldStartTime = startTime;
      this.startTime = currentTimeInSeconds();
      final double scalingFactor = exp(-alpha * (startTime - oldStartTime));
      final ArrayList<Double> keys = new ArrayList<>(values.keySet());
      for (Double key : keys) {
        final WeightedSnapshot.WeightedSample sample = values.remove(key);
        final WeightedSnapshot.WeightedSample newSample =
            new WeightedSnapshot.WeightedSample(sample.value, sample.weight * scalingFactor);
        values.put(key * scalingFactor, newSample);
      }
      // make sure the counter is in sync with the number of stored samples.
      count.set(values.size());
    } finally {
      unlockForRescale();
    }
  }
}

代码示例来源:origin: networknt/light-4j

private void rescale(long now, long next) {
  if (nextScaleTime.compareAndSet(next, now + RESCALE_THRESHOLD)) {
    lockForRescale();
    try {
      final long oldStartTime = startTime;
      this.startTime = currentTimeInSeconds();
      final double scalingFactor = exp(-alpha * (startTime - oldStartTime));
      final ArrayList<Double> keys = new ArrayList<>(values.keySet());
      for (Double key : keys) {
        final WeightedSample sample = values.remove(key);
        final WeightedSample newSample = new WeightedSample(sample.value, sample.weight * scalingFactor);
        values.put(key * scalingFactor, newSample);
      }
      // make sure the counter is in sync with the number of stored samples.
      count.set(values.size());
    } finally {
      unlockForRescale();
    }
  }
}

代码示例来源:origin: twitter/distributedlog

private Future<Optional<URI>> fetchLogLocation(final String logName) {
  final Promise<Optional<URI>> fetchPromise = new Promise<Optional<URI>>();
  Set<URI> uris = subNamespaces.keySet();
  List<Future<Optional<URI>>> fetchFutures = Lists.newArrayListWithExpectedSize(uris.size());
  for (URI uri : uris) {

代码示例来源:origin: io.dropwizard.metrics/metrics-core

private void rescale(long now, long next) {
  lockForRescale();
  try {
    if (nextScaleTime.compareAndSet(next, now + RESCALE_THRESHOLD)) {
      final long oldStartTime = startTime;
      this.startTime = currentTimeInSeconds();
      final double scalingFactor = exp(-alpha * (startTime - oldStartTime));
      if (Double.compare(scalingFactor, 0) == 0) {
        values.clear();
      } else {
        final ArrayList<Double> keys = new ArrayList<>(values.keySet());
        for (Double key : keys) {
          final WeightedSample sample = values.remove(key);
          final WeightedSample newSample = new WeightedSample(sample.value, sample.weight * scalingFactor);
          if (Double.compare(newSample.weight, 0) == 0) {
            continue;
          }
          values.put(key * scalingFactor, newSample);
        }
      }
      // make sure the counter is in sync with the number of stored samples.
      count.set(values.size());
    }
  } finally {
    unlockForRescale();
  }
}

代码示例来源:origin: oracle/helidon

private void rescale(long now, long next) {
  lockForRescale();
  try {
    if (nextScaleTime.compareAndSet(next, now + RESCALE_THRESHOLD)) {
      final long oldStartTime = startTime;
      this.startTime = currentTimeInSeconds();
      final double scalingFactor = exp(-alpha * (startTime - oldStartTime));
      if (Double.compare(scalingFactor, 0) == 0) {
        values.clear();
      } else {
        final ArrayList<Double> keys = new ArrayList<Double>(values.keySet());
        for (Double key : keys) {
          final WeightedSnapshot.WeightedSample sample = values.remove(key);
          final WeightedSnapshot.WeightedSample newSample = new WeightedSnapshot.WeightedSample(sample.getValue(),
                                                     sample.getWeight() * scalingFactor);
          values.put(key * scalingFactor, newSample);
        }
      }
      // make sure the counter is in sync with the number of stored samples.
      count.set(values.size());
    }
  } finally {
    unlockForRescale();
  }
}

代码示例来源:origin: apache/ignite

@Override public void onEvent(Event evt) {
    int evtType = evt.type();
    assert evtType == EVT_NODE_FAILED || evtType == EVT_NODE_LEFT;
    if (affMap.isEmpty())
      return; // Skip empty affinity map.
    final DiscoveryEvent discoEvt = (DiscoveryEvent)evt;
    // Clean up affinity functions if such cache no more exists.
    final Collection<String> caches = ctx.cache().cacheNames();
    final Collection<AffinityAssignmentKey> rmv = new HashSet<>();
    for (AffinityAssignmentKey key : affMap.keySet()) {
      if (!caches.contains(key.cacheName) || key.topVer.topologyVersion() < discoEvt.topologyVersion() - 10)
        rmv.add(key);
    }
    if (!rmv.isEmpty()) {
      ctx.timeout().addTimeoutObject(
        new GridTimeoutObjectAdapter(
          IgniteUuid.fromUuid(ctx.localNodeId()),
          AFFINITY_MAP_CLEAN_UP_DELAY) {
            @Override public void onTimeout() {
              affMap.keySet().removeAll(rmv);
            }
          });
    }
  }
};

代码示例来源:origin: apache/hbase

@Test
public void testKeys() throws Exception {
 for (Long key:csm.keySet()) {
  //assertTrue(m.containsKey(key));
  assertNotNull(m.get(key));
  assertNotNull(m.remove(key));
  assertNull(m.get(key));
 }
}

代码示例来源:origin: mulesoft/mule

@Override
public List<String> allKeys() throws ObjectStoreException {
 return store.keySet().stream().map(String::valueOf).collect(toList());
}

代码示例来源:origin: rackerlabs/blueflood

public static Map<Range, ConcurrentHashMap<Locator, Points>> getEligibleData() {
    if (locatorToTimestampToPoint.size() <= RANGE_BUFFER) {
      log.debug("Range buffer still not exceeded. Returning null data to rollup generator");
      return null;
    } else {
      Object[] sortedKeySet = locatorToTimestampToPoint.keySet().toArray();
      Range cuttingPoint = (Range) sortedKeySet[sortedKeySet.length - RANGE_BUFFER - 1];
      log.info("Found completed ranges up to the threshold range of {}", cuttingPoint);
      completedRangesReturned.mark();
      return locatorToTimestampToPoint.headMap(cuttingPoint, true);
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

/**
 * @return the commits to this branch.
 */
SortedSet<Revision> getCommits() {
  return commits.keySet();
}

代码示例来源:origin: io.druid/druid-server

@JsonProperty
@Override
public Set<DataSegment> getSegmentsToLoad()
{
 return segmentsToLoad.keySet();
}

代码示例来源:origin: pravega/pravega

@Override
public CompletableFuture<List<String>> getEntities(final String hostId) {
  Preconditions.checkNotNull(hostId);
  ConcurrentSkipListMap<String, byte[]> children = hostTable.get(hostId);
  if (children == null) {
    return CompletableFuture.completedFuture(Collections.emptyList());
  } else {
    return CompletableFuture.completedFuture(children.keySet().stream().collect(Collectors.toList()));
  }
}

代码示例来源:origin: org.apache.hbase/hbase-common

@Test
public void testKeys() throws Exception {
 for (Long key:csm.keySet()) {
  //assertTrue(m.containsKey(key));
  assertNotNull(m.get(key));
  assertNotNull(m.remove(key));
  assertNull(m.get(key));
 }
}

相关文章

ConcurrentSkipListMap类方法