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

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

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

ConcurrentSkipListMap.floorKey介绍

暂无

代码示例

代码示例来源:origin: lealone/Lealone

@Override
public K floorKey(K key) { // 小于或等于给定key的最大key
  try {
    return skipListMap.floorKey(key);
  } catch (NoSuchElementException e) {
    return null;
  }
}

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

@Test
public void testFloorKey() throws Exception {
 for ( int i =0 ; i < 100; i ++) {
  Long key = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.floorKey(key), m.floorKey(key));
 }
}

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

if (!doAssumeGranularBlocks) {
 Long prevOffset = cache.floorKey(absOffset);
 if (prevOffset != null) {
  absOffset = prevOffset;

代码示例来源:origin: lealone/Lealone

k1 = buffer.lowerKey(key);
else
  k1 = buffer.floorKey(key);

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

private Long getInFlightBelow(long ackLevel) {
  synchronized (lock) {
    return inflight.floorKey(ackLevel);
  }
}

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

/**
 * @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: cinchapi/concourse

@Override
public K floorKey(K key) {
  long[] stamps = grabAllSegmentWriteLocks();
  try {
    sort();
    return sorted.floorKey(key);
  }
  finally {
    releaseSegmentLocks(stamps);
  }
}

代码示例来源:origin: org.glassfish.main.elasticity/elastic-api

private NavigableMap<Long, MetricEntryHolder> getOldestView(long duration, TimeUnit unit) {
  NavigableMap<Long, MetricEntryHolder> result = _emptyMap;
  if (! map.isEmpty()) {
    Long maxKey = map.lastKey();
    if (maxKey != null) {
      Long minKey = map.floorKey(maxKey - TimeUnit.MILLISECONDS.convert(duration, unit));
      if (minKey != null) {
        result = map.subMap(map.firstKey(), true, minKey, true);
      }
    }
  }
  
  return result;
}

代码示例来源:origin: org.glassfish.main.elasticity/elastic-api

private NavigableMap<Long, MetricEntryHolder> getView(long duration, TimeUnit unit, boolean allowPartialData)
  throws NotEnoughMetricDataException {
  NavigableMap<Long, MetricEntryHolder> result = null;
  if (! map.isEmpty()) {
    Long maxKey = map.lastKey();
    if (maxKey != null) {
      Long minKey = map.floorKey(maxKey - TimeUnit.MILLISECONDS.convert(duration, unit));
      if (minKey != null) {
        result = map.subMap(minKey, true, maxKey, true);
      } else if (allowPartialData) {
        minKey = map.ceilingKey(maxKey - TimeUnit.MILLISECONDS.convert(duration, unit));
        result = map.subMap(minKey, true, maxKey, true);
      }
    }
  }
  if (result == null) {
    throw new NotEnoughMetricDataException("Not enough metric data for "  + duration + " " + unit);
  }
  NavigableMap<Long, MetricEntryHolder> view =
      new ConcurrentSkipListMap<Long, MetricEntryHolder>();
  for (Long k : result.keySet()) {
    view.put(k, result.get(k));
  }
  return view;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

@Test
public void testFloorKey() throws Exception {
 for ( int i =0 ; i < 100; i ++) {
  Long key = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.floorKey(key), m.floorKey(key));
 }
}

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

@Test
public void testFloorKey() throws Exception {
 for ( int i =0 ; i < 100; i ++) {
  Long key = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.floorKey(key), m.floorKey(key));
 }
}

代码示例来源:origin: org.apache.hive/hive-llap-server

if (!doAssumeGranularBlocks) {
 Long prevOffset = cache.floorKey(absOffset);
 if (prevOffset != null) {
  absOffset = prevOffset;

相关文章

ConcurrentSkipListMap类方法