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

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

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

ConcurrentSkipListMap.ceilingKey介绍

暂无

代码示例

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

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

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

@Test
public void testCeilingKey() throws Exception {
 assertEquals(csm.ceilingKey(4000L), m.ceilingKey(4000L));
 assertEquals(csm.ceilingKey(400L), m.ceilingKey(400L));
 assertEquals(csm.ceilingKey(-1L), m.ceilingKey(-1L));
 for ( int i =0 ; i < 100; i ++) {
  Long key = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.ceilingKey(key), m.ceilingKey(key));
 }
}

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

k1 = buffer.higherKey(key);
  else
    k1 = buffer.ceilingKey(key);
} else {
  if (excluding)

代码示例来源:origin: palantir/atlasdb

private Key getKey(Table table, Cell cell, long timestamp) {
  byte[] row = cell.getRowName();
  byte[] col = cell.getColumnName();
  Key nextKey = table.entries.ceilingKey(new Key(row, ArrayUtils.EMPTY_BYTE_ARRAY, Long.MIN_VALUE));
  if (nextKey != null && nextKey.matchesRow(row)) {
    // Save memory by sharing rows.
    row = nextKey.row;
  }
  return new Key(row, col, timestamp);
}

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

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

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

@Test
public void testCeilingKey() throws Exception {
 assertEquals(csm.ceilingKey(4000L), m.ceilingKey(4000L));
 assertEquals(csm.ceilingKey(400L), m.ceilingKey(400L));
 assertEquals(csm.ceilingKey(-1L), m.ceilingKey(-1L));
 for ( int i =0 ; i < 100; i ++) {
  Long key = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.ceilingKey(key), m.ceilingKey(key));
 }
}

代码示例来源:origin: com.palantir.atlasdb/atlasdb-client

private Key getKey(Table table, Cell cell, long timestamp) {
  byte[] row = cell.getRowName();
  byte[] col = cell.getColumnName();
  Key nextKey = table.entries.ceilingKey(new Key(row, ArrayUtils.EMPTY_BYTE_ARRAY, Long.MIN_VALUE));
  if (nextKey != null && nextKey.matchesRow(row)) {
    // Save memory by sharing rows.
    row = nextKey.row;
  }
  return new Key(row, col, timestamp);
}

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

@Test
public void testCeilingKey() throws Exception {
 assertEquals(csm.ceilingKey(4000L), m.ceilingKey(4000L));
 assertEquals(csm.ceilingKey(400L), m.ceilingKey(400L));
 assertEquals(csm.ceilingKey(-1L), m.ceilingKey(-1L));
 for ( int i =0 ; i < 100; i ++) {
  Long key = ThreadLocalRandom.current().nextLong();
  assertEquals(csm.ceilingKey(key), m.ceilingKey(key));
 }
}

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

public HDFSGatewayEventImpl getFromQueueOrBuffer(KeyToSeqNumObject key) {
 KeyToSeqNumObject result = events.ceilingKey(key);
 if (result != null && Bytes.compareTo(key.getRegionkey(), result.getRegionkey()) == 0) {
  
  // first try to fetch the buffered event to make it fast. 
  HDFSGatewayEventImpl evt = events.get(result);
  if (evt != NULL) {
   return evt;
  }
  // now try to fetch the event from the queue region
  evt = (HDFSGatewayEventImpl) getNoLRU(result.getSeqNum(), true, false, false);
  if (evt != null) {
   return evt;
  }
  
  // try to fetch again from the buffered events to avoid a race between 
  // item deletion and the above two statements. 
  evt = events.get(result);
  if (evt != NULL) {
   return evt;
  }
  
 }
 return null;
}

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

public HDFSGatewayEventImpl getFromQueueOrBuffer(KeyToSeqNumObject key) {
 KeyToSeqNumObject result = events.ceilingKey(key);
 if (result != null && Bytes.compareTo(key.getRegionkey(), result.getRegionkey()) == 0) {
  
  // first try to fetch the buffered event to make it fast. 
  HDFSGatewayEventImpl evt = events.get(result);
  if (evt != NULL) {
   return evt;
  }
  // now try to fetch the event from the queue region
  evt = (HDFSGatewayEventImpl) getNoLRU(result.getSeqNum(), true, false, false);
  if (evt != null) {
   return evt;
  }
  
  // try to fetch again from the buffered events to avoid a race between 
  // item deletion and the above two statements. 
  evt = events.get(result);
  if (evt != NULL) {
   return evt;
  }
  
 }
 return null;
}

相关文章

ConcurrentSkipListMap类方法