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

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

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

ConcurrentSkipListMap.headMap介绍

暂无

代码示例

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

/**
 * @throws ClassCastException {@inheritDoc}
 * @throws NullPointerException if {@code toKey} is null
 * @throws IllegalArgumentException {@inheritDoc}
 */
public ConcurrentNavigableMap<K,V> headMap(K toKey) {
  return headMap(toKey, false);
}

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

@Override
public long sizeFromStart(Object end) {
 byte[] endBytes = ByteComparator.MAX_BYTES;
 return map.headMap(new Pair(end, endBytes)).size();
}

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

/**
 * @param res Current result.
 * @param batch Current batch.
 * @param backup Backup entry flag.
 * @return New result.
 */
@Nullable private Object processPending(@Nullable Object res, Batch batch, boolean backup) {
  if (pending.floorKey(batch.endCntr) != null) {
    for (Map.Entry<Long, CacheContinuousQueryEntry> p : pending.headMap(batch.endCntr, true).entrySet()) {
      long cntr = p.getKey();
      assert cntr <= batch.endCntr;
      if (pending.remove(p.getKey()) != null) {
        if (cntr < batch.startCntr)
          res = addResult(res, p.getValue(), backup);
        else
          res = batch.processEntry0(res, p.getKey(), p.getValue(), backup);
      }
    }
  }
  return res;
}

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

private void trim() {
    measurements.headMap(getTick() - window).clear();
  }
}

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

/**
 * Removes cached affinity instances with affinity topology versions less than {@code topVer}.
 *
 * @param topVer topology version.
 */
public void removeCachedAffinity(AffinityTopologyVersion topVer) {
  assert topVer != null;
  int oldSize = affMap.size();
  Iterator<Map.Entry<AffinityAssignmentKey, IgniteInternalFuture<AffinityInfo>>> it =
    affMap.headMap(new AffinityAssignmentKey(topVer)).entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry<AffinityAssignmentKey, IgniteInternalFuture<AffinityInfo>> entry = it.next();
    assert entry.getValue() != null;
    if (!entry.getValue().isDone())
      continue;
    it.remove();
  }
  if (log.isDebugEnabled())
    log.debug("Affinity cached values were cleared: " + (oldSize - affMap.size()));
}

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

@Override
public CloseableIterator<IndexEntry> descendingIterator(Object end, boolean endInclusive) {
 byte[] endBytes = endInclusive ? ByteComparator.MAX_BYTES : ByteComparator.MIN_BYTES;
 return new Itr(
   map.headMap(new Pair(end, endBytes), endInclusive).descendingMap().entrySet().iterator());
}

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

@Override
public CloseableIterator<CachedDeserializable> descendingKeyIterator(Object end,
  boolean endInclusive) {
 byte[] endBytes = endInclusive ? ByteComparator.MAX_BYTES : ByteComparator.MIN_BYTES;
 return new KeyItr(
   map.headMap(new Pair(end, endBytes), endInclusive).descendingMap().entrySet().iterator());
}

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

private void trim() {
    final long now = getTick();
    final long windowStart = now - window;
    final long windowEnd = now + CLEAR_BUFFER;
    if (windowStart < windowEnd) {
      measurements.headMap(windowStart).clear();
      measurements.tailMap(windowEnd).clear();
    } else {
      measurements.subMap(windowEnd, windowStart).clear();
    }
  }
}

代码示例来源: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: MobiVM/robovm

/**
 * @throws ClassCastException {@inheritDoc}
 * @throws NullPointerException if {@code toKey} is null
 * @throws IllegalArgumentException {@inheritDoc}
 */
public ConcurrentNavigableMap<K,V> headMap(K toKey) {
  return headMap(toKey, false);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * @throws ClassCastException {@inheritDoc}
 * @throws NullPointerException if {@code toKey} is null
 * @throws IllegalArgumentException {@inheritDoc}
 */
public ConcurrentNavigableMap<K,V> headMap(K toKey) {
  return headMap(toKey, false);
}

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

/**
 * Remove all events with event numbers below the provided level from inflight and return them.
 */
private List<PendingEvent> removeInflightBelow(long ackLevel) {
  synchronized (lock) {
    ConcurrentNavigableMap<Long, PendingEvent> acked = inflight.headMap(ackLevel, true);
    List<PendingEvent> result = new ArrayList<>(acked.values());
    acked.clear();
    return result;
  }
}

代码示例来源:origin: com.codahale.metrics/metrics-core

private void trim() {
    measurements.headMap(getTick() - window).clear();
  }
}

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

/**
 * Remove the values that are earlier than current window
 */
private void removeExpireValues() {
 storage.headMap(getUpdatingTime() - windowMs).clear();
}

代码示例来源:origin: org.apache.geode/gemfire-core

@Override
public long sizeFromStart(Object end) {
 byte[] endBytes = ByteComparator.MAX_BYTES;
 return map.headMap(new Pair(end, endBytes)).size();
}

代码示例来源:origin: com.networknt/metrics

private void trim() {
    measurements.headMap(getTick() - window).clear();
  }
}

代码示例来源:origin: cinchapi/concourse

@Override
public ConcurrentNavigableMap<K, V> headMap(K toKey, boolean inclusive) {
  long[] stamps = grabAllSegmentWriteLocks();
  try {
    sort();
    return sorted.headMap(toKey, inclusive);
  }
  finally {
    releaseSegmentLocks(stamps);
  }
}

代码示例来源:origin: cinchapi/concourse

@Override
public ConcurrentNavigableMap<K, V> headMap(K key) {
  long[] stamps = grabAllSegmentWriteLocks();
  try {
    sort();
    return sorted.headMap(key);
  }
  finally {
    releaseSegmentLocks(stamps);
  }
}

代码示例来源:origin: io.snappydata/gemfire-core

@Override
public CloseableIterator<IndexEntry> descendingIterator(Object end,
  boolean endInclusive) {
 byte[] endBytes = endInclusive ? ByteComparator.MAX_BYTES : ByteComparator.MIN_BYTES;
 return new Itr(map.headMap(new Pair(end, endBytes), endInclusive).descendingMap().entrySet().iterator());
}

代码示例来源:origin: org.apache.geode/gemfire-core

@Override
public CloseableIterator<CachedDeserializable> descendingKeyIterator(Object end,
  boolean endInclusive) {
 byte[] endBytes = endInclusive ? ByteComparator.MAX_BYTES : ByteComparator.MIN_BYTES;
 return new KeyItr(map.headMap(new Pair(end, endBytes), endInclusive).descendingMap().entrySet().iterator());
}

相关文章

ConcurrentSkipListMap类方法