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

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

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

ConcurrentSkipListMap.higherEntry介绍

[英]Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key. The returned entry does not support the Entry.setValue method.
[中]返回与严格大于给定键的最小键关联的键值映射,如果没有这样的键,则返回null。返回的条目支持该条目。设置值方法。

代码示例

代码示例来源:origin: co.paralleluniverse/galaxy

private Node getNextNode(String node) {
  assert ordered;
  synchronized (nodes) {
    final Map.Entry<String, Node> entry = nodes.higherEntry(node);
    return (entry != null ? entry.getValue() : null);
  }
}

代码示例来源:origin: the8472/mldht

public List<KBucketEntry> get(Key target, int targetSize)
{
  ArrayList<KBucketEntry> closestSet = new ArrayList<>(2 * targetSize);
  
  Map.Entry<Key, CacheBucket> ceil = cache.ceilingEntry(target);
  Map.Entry<Key, CacheBucket> floor = cache.floorEntry(target);
  
  do
  {
    if(floor != null)
    {
      closestSet.addAll(floor.getValue().entries);
      floor = cache.lowerEntry(floor.getKey());
    }
      
    if(ceil != null)
    {
      closestSet.addAll(ceil.getValue().entries);
      ceil = cache.higherEntry(ceil.getKey());
    }
  } while (closestSet.size() / 2 < targetSize && (floor != null || ceil != null));
  
  return closestSet;
}

代码示例来源:origin: limeng32/mybatis.flying

private void observerMethodsFission(ConcurrentSkipListMap<Class<?>, Set<Method>> observerMethodMap,
    Entry<Class<?>, Set<Method>> currentE, ConcurrentSkipListMap<Class<?>, Set<Method>> observerMethodMapNew) {
  if (observerMethodMap.size() != 0) {
    if (currentE == null) {
      currentE = observerMethodMap.firstEntry();
    }
    observerMethodMapNew.put(currentE.getKey(), currentE.getValue());
    observerMethodsFissionFission(observerMethodMap, observerMethodMapNew);
    Entry<Class<?>, Set<Method>> nextE = observerMethodMap.higherEntry(currentE.getKey());
    if (nextE != null) {
      observerMethodsFission(observerMethodMap, nextE, observerMethodMapNew);
    }
  }
}

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

@Override
public java.util.Map.Entry<K, V> higherEntry(K key) {
  long[] stamps = grabAllSegmentWriteLocks();
  try {
    sort();
    return sorted.higherEntry(key);
  }
  finally {
    releaseSegmentLocks(stamps);
  }
}

代码示例来源:origin: indeedeng/lsmtree

@Override
  protected Entry<K, V> computeNext() {
    final Map.Entry<K, Object> entry;
    if (!initialized) {
      initialized = true;
      if (start == null) {
        entry = map.firstEntry();
      } else if (startInclusive) {
        entry = map.ceilingEntry(start);
      } else {
        entry = map.higherEntry(start);
      }
    } else {
      entry = map.higherEntry(key);
    }
    if (entry == null) {
      return endOfData();
    }
    key = entry.getKey();
    final Object value = entry.getValue();
    if (value == deleted) return Entry.createDeleted(key);
    return Entry.create(key, (V)value);
  }
};

代码示例来源:origin: the8472/mldht

entry = cache.higherEntry(current.prefix);
if(entry == null)
  return;

代码示例来源:origin: addthis/hydra

/**
 * Return true if the page was evicted from the cache
 *
 * @return true if the page was evicted from the cache
 */
protected boolean removePageFromCache(K targetKey) {
  assert (!targetKey.equals(negInf));
  Page<K, V> currentPage;
  Map.Entry<K, Page<K, V>> prevEntry, currentEntry;
  prevEntry = getCache().lowerEntry(targetKey);
  currentEntry = getCache().higherEntry(prevEntry.getKey());
  if (currentEntry != null) {
    currentPage = currentEntry.getValue();
    int compareKeys = compareKeys(targetKey, currentPage.getFirstKey());
    if (compareKeys < 0) {
      return false;
    } else if (compareKeys == 0 && currentPage.keys() == null &&
        currentPage.getState() == ExternalMode.DISK_MEMORY_IDENTICAL) {
      currentPage.setState(ExternalMode.MEMORY_EVICTED);
      getCache().remove(targetKey);
      cacheSize.getAndDecrement();
      return true;
    }
  }
  return false;
}

代码示例来源:origin: co.paralleluniverse/galaxy

private void nodeRemoved(String name) {
  try {
    boolean _doneInit;
    final Node node;
    Node previous = null, next = null;
    synchronized (nodes) {
      while (!doneInit)
        nodes.wait();
      if (ordered) {
        previous = value(nodes.lowerEntry(name));
        next = value(nodes.higherEntry(name));
      }
      node = nodes.remove(name);
      _doneInit = this.doneInit;
    }
    if (node.isComplete()) {
      for (Listener listener : listeners)
        listener.nodeChildDeleted(branchRoot, name);
    }
    if (ordered) {
      if (_doneInit && next != null && (previous == null || previous.isComplete()))
        next.predecessorsComplete();
    }
  } catch (InterruptedException e) {
    throw new RuntimeException();
  }
}

代码示例来源:origin: addthis/hydra

Map.Entry<K, Page<K, V>> currentEntry = getCache().higherEntry(prevKey);

代码示例来源:origin: addthis/hydra

do {
  writeUnlockAndNull(next);
  Map.Entry<K, Page<K, V>> higherEntry = getCache().higherEntry(current.getFirstKey());
  if (higherEntry == null) {
    break findnext;

相关文章

ConcurrentSkipListMap类方法