本文整理了Java中java.util.concurrent.ConcurrentSkipListMap.ceilingEntry()
方法的一些代码示例,展示了ConcurrentSkipListMap.ceilingEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListMap.ceilingEntry()
方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListMap
类名称:ConcurrentSkipListMap
方法名:ceilingEntry
[英]Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such entry. The returned entry does not support the Entry.setValue method.
[中]返回与大于或等于给定键的最小键关联的键值映射,如果没有此类项,则返回null。返回的条目不支持该条目。设置值方法。
代码示例来源:origin: neo4j/neo4j
private static void doCheckAccess( long pointer, int size )
{
long boundary = pointer + size;
Allocation allocation = lastUsedAllocation.get();
if ( allocation != null )
{
if ( compareUnsigned( allocation.pointer, pointer ) <= 0 &&
compareUnsigned( allocation.boundary, boundary ) > 0 &&
allocation.freeCounter == freeCounter.get() )
{
return;
}
}
Map.Entry<Long,Allocation> fentry = allocations.floorEntry( boundary );
if ( fentry == null || compareUnsigned( fentry.getValue().boundary, boundary ) < 0 )
{
Map.Entry<Long,Allocation> centry = allocations.ceilingEntry( pointer );
throwBadAccess( pointer, size, fentry, centry );
}
//noinspection ConstantConditions
lastUsedAllocation.set( fentry.getValue() );
}
代码示例来源:origin: tjake/Solandra
public ConcurrentNavigableMap<Term, LucandraTermInfo[]> skipTo(Term skip) throws IOException
{
Pair<Term, Term> range = null;
int bufferSize = termList.isEmpty() ? 1 : 3;
// verify we've buffered sufficiently
Map.Entry<Term, Pair<Term, Term>> tailEntry = termQueryBoundries.ceilingEntry(skip);
boolean needsBuffering = true;
if (tailEntry != null)
{
range = tailEntry.getValue();
//skip term must be within a buffered range avoid rebuffering
if (skip.compareTo(range.left) >= 0 && (!range.right.equals(emptyTerm) && skip.compareTo(range.right) < 0))
{
needsBuffering = false;
}
}
ConcurrentNavigableMap<Term, LucandraTermInfo[]> subList = emptyMap;
if (needsBuffering)
{
range = bufferTerms(skip, bufferSize);
}
//logger.info(Thread.currentThread().getName()+" rebuffered "+needsBuffering+" "+range);
if (skip.compareTo(range.left) >= 0 && (!range.right.equals(emptyTerm)) && skip.compareTo(range.right) <= 0)
{
subList = termList.subMap(skip, true, range.right, true);
}
return subList;
}
代码示例来源:origin: apache/accumulo
private KeyExtent getFromCache(Text row) {
Entry<Text,KeyExtent> entry = extents.ceilingEntry(row);
if (entry != null && entry.getValue().contains(row)) {
return entry.getValue();
}
return 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: cinchapi/concourse
@Override
public java.util.Map.Entry<K, V> ceilingEntry(K key) {
long[] stamps = grabAllSegmentWriteLocks();
try {
sort();
return sorted.ceilingEntry(key);
}
finally {
releaseSegmentLocks(stamps);
}
}
代码示例来源:origin: io.github.matzoliv/async-channels-core
public static ReadPort createTimerChannel(long delay) {
long timeout = delay + System.currentTimeMillis();
Map.Entry<Long, TimeoutQueueEntry> tqe = timeoutsMap.ceilingEntry(timeout);
if (tqe != null) {
if (tqe.getKey() < (timeout + TIMEOUTS_RESOLUTION_MS)) {
return tqe.getValue().getChannel();
}
}
Channel c = new ManyToManyChannel(new QueueBuffer(0));
TimeoutQueueEntry newTqe = new TimeoutQueueEntry(c, timeout);
timeoutsMap.put(timeout, newTqe);
timeoutsQueue.put(newTqe);
return c;
}
代码示例来源:origin: org.neo4j/neo4j-unsafe
private static void doCheckAccess( long pointer, int size )
{
long boundary = pointer + size;
Allocation allocation = lastUsedAllocation.get();
if ( allocation != null )
{
if ( compareUnsigned( allocation.pointer, pointer ) <= 0 &&
compareUnsigned( allocation.boundary, boundary ) > 0 &&
allocation.freeCounter == freeCounter.get() )
{
return;
}
}
Map.Entry<Long,Allocation> fentry = allocations.floorEntry( boundary );
if ( fentry == null || compareUnsigned( fentry.getValue().boundary, boundary ) < 0 )
{
Map.Entry<Long,Allocation> centry = allocations.ceilingEntry( pointer );
throwBadAccess( pointer, size, fentry, centry );
}
//noinspection ConstantConditions
lastUsedAllocation.set( fentry.getValue() );
}
代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons
private int randomFamilyId(ThreadLocalRandom random) {
Map.Entry<Integer, AtomicInteger> first = familyIds.firstEntry();
Map.Entry<Integer, AtomicInteger> last = familyIds.lastEntry();
if (first == null || last == null) return 0;
Map.Entry<Integer, AtomicInteger> ceiling = familyIds.ceilingEntry(random.nextInt(first.getKey(), last.getKey() + 1));
return ceiling == null ? 0 : ceiling.getKey();
}
代码示例来源:origin: io.github.pcmind/leveldb
public LookupResult get(LookupKey key)
{
requireNonNull(key, "key is null");
InternalKey internalKey = key.getInternalKey();
Entry<InternalKey, Slice> entry = table.ceilingEntry(internalKey);
if (entry == null) {
return null;
}
InternalKey entryKey = entry.getKey();
if (entryKey.getUserKey().equals(key.getUserKey())) {
if (entryKey.getValueType() == ValueType.DELETION) {
return LookupResult.deleted(key);
}
else {
return LookupResult.ok(key, entry.getValue());
}
}
return null;
}
代码示例来源: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
Map.Entry<Key, CacheAnchorPoint> anchor = anchors.ceilingEntry(parent);
if(anchor == null || !parent.isPrefixOf(anchor.getValue()) || current.entries.size()+next.entries.size() < DHTConstants.MAX_CONCURRENT_REQUESTS)
代码示例来源:origin: the8472/mldht
Map.Entry<Key, CacheAnchorPoint> anchorEntry = anchors.ceilingEntry(targetBucket.prefix);
代码示例来源:origin: semanticvectors/semanticvectors
if (termDic.get(obsem).ceilingEntry(test) != null) {
String testConcept = termDic.get(obsem).ceilingEntry(test).getValue();
testConcept = termDic.get("dsyn").ceilingEntry(test).getValue();
代码示例来源:origin: semanticvectors/semanticvectors
if (termDic.ceilingEntry(test) != null) {
String testTerm = termDic.ceilingEntry(test).getValue();
if (! testTerm.equals(coterm))
randomTerm = elementalTermVectors.getVector(testTerm);
内容来源于网络,如有侵权,请联系作者删除!