当前位置: 首页>>代码示例>>Java>>正文


Java ConcurrentNavigableMap.floorEntry方法代码示例

本文整理汇总了Java中java.util.concurrent.ConcurrentNavigableMap.floorEntry方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentNavigableMap.floorEntry方法的具体用法?Java ConcurrentNavigableMap.floorEntry怎么用?Java ConcurrentNavigableMap.floorEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.ConcurrentNavigableMap的用法示例。


在下文中一共展示了ConcurrentNavigableMap.floorEntry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFloorEntry

import java.util.concurrent.ConcurrentNavigableMap; //导入方法依赖的package包/类
/**
 * floorEntry returns preceding entry.
 */
public void testFloorEntry() {
    ConcurrentNavigableMap map = map5();
    Map.Entry e1 = map.floorEntry(three);
    assertEquals(three, e1.getKey());

    Map.Entry e2 = map.floorEntry(six);
    assertEquals(five, e2.getKey());

    Map.Entry e3 = map.floorEntry(one);
    assertEquals(one, e3.getKey());

    Map.Entry e4 = map.floorEntry(zero);
    assertNull(e4);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ConcurrentSkipListSubMapTest.java

示例2: testDescendingFloorEntry

import java.util.concurrent.ConcurrentNavigableMap; //导入方法依赖的package包/类
/**
 * floorEntry returns preceding entry.
 */
public void testDescendingFloorEntry() {
    ConcurrentNavigableMap map = dmap5();
    Map.Entry e1 = map.floorEntry(m3);
    assertEquals(m3, e1.getKey());

    Map.Entry e2 = map.floorEntry(m6);
    assertEquals(m5, e2.getKey());

    Map.Entry e3 = map.floorEntry(m1);
    assertEquals(m1, e3.getKey());

    Map.Entry e4 = map.floorEntry(zero);
    assertNull(e4);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ConcurrentSkipListSubMapTest.java

示例3: getCachedLocation

import java.util.concurrent.ConcurrentNavigableMap; //导入方法依赖的package包/类
/**
 * Search the cache for a location that fits our table and row key.
 * Return null if no suitable region is located.
 *
 * @return Null or region location found in cache.
 */
public RegionLocations getCachedLocation(final TableName tableName, final byte [] row) {
  ConcurrentNavigableMap<byte[], RegionLocations> tableLocations =
    getTableLocations(tableName);

  Entry<byte[], RegionLocations> e = tableLocations.floorEntry(row);
  if (e == null) {
    if (metrics!= null) metrics.incrMetaCacheMiss();
    return null;
  }
  RegionLocations possibleRegion = e.getValue();

  // make sure that the end key is greater than the row we're looking
  // for, otherwise the row actually belongs in the next region, not
  // this one. the exception case is when the endkey is
  // HConstants.EMPTY_END_ROW, signifying that the region we're
  // checking is actually the last region in the table.
  byte[] endKey = possibleRegion.getRegionLocation().getRegionInfo().getEndKey();
  if (Bytes.equals(endKey, HConstants.EMPTY_END_ROW) ||
      getRowComparator(tableName).compareRows(
          endKey, 0, endKey.length, row, 0, row.length) > 0) {
    if (metrics != null) metrics.incrMetaCacheHit();
    return possibleRegion;
  }

  // Passed all the way through, so we got nothing - complete cache miss
  if (metrics != null) metrics.incrMetaCacheMiss();
  return null;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:MetaCache.java


注:本文中的java.util.concurrent.ConcurrentNavigableMap.floorEntry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。