本文整理了Java中java.util.concurrent.ConcurrentSkipListMap.firstEntry()
方法的一些代码示例,展示了ConcurrentSkipListMap.firstEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListMap.firstEntry()
方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListMap
类名称:ConcurrentSkipListMap
方法名:firstEntry
[英]Returns a key-value mapping associated with the least key in this map, or null if the map is empty. The returned entry does not support the Entry.setValue method.
[中]
代码示例来源:origin: qunarcorp/qmq
public LogSegment firstSegment() {
final Map.Entry<Long, LogSegment> entry = segments.firstEntry();
return entry == null ? null : entry.getValue();
}
代码示例来源:origin: apache/ignite
/** */
public UUID getCoordinator() {
Map.Entry<Long, ZookeeperClusterNode> e = rtState.top.nodesByOrder.firstEntry();
return e != null ? e.getValue().id() : null;
}
代码示例来源:origin: apache/hbase
@Test
public void testFirstEntry() throws Exception {
assertEquals(csm.firstEntry().getKey(), m.firstEntry().getKey());
assertEquals(csm.firstEntry().getValue(), m.firstEntry().getValue());
assertEquals(csm.firstEntry(), m.firstEntry());
}
代码示例来源:origin: loklak/loklak_server
Map.Entry<Date, Track> t = this.pendingQueue.firstEntry();
if (t == null) break timeoutcheck;
boolean timeout = t.getKey().getTime() + AccessTracker.this.track_timeout < System.currentTimeMillis();
代码示例来源:origin: apache/incubator-druid
currentlyProcessing = segmentsToDrop.firstEntry().getValue();
log.debug("Server[%s] dropping [%s]", basePath, currentlyProcessing.getSegmentId());
} else if (!segmentsToLoad.isEmpty()) {
currentlyProcessing = segmentsToLoad.firstEntry().getValue();
log.debug("Server[%s] loading [%s]", basePath, currentlyProcessing.getSegmentId());
} else {
代码示例来源:origin: mulesoft/mule
private int expireAndCount() {
// first we trim the store according to max size
int expiredEntries = 0;
final long now = System.nanoTime();
Map.Entry<?, ?> oldestEntry;
purge: while ((oldestEntry = store.firstEntry()) != null) {
Long oldestKey = (Long) oldestEntry.getKey();
long oldestKeyValue = oldestKey.longValue();
if (NANOSECONDS.toMillis(now - oldestKeyValue) >= entryTTL) {
store.remove(oldestKey);
expiredEntries++;
} else {
break purge;
}
}
return expiredEntries;
}
代码示例来源:origin: co.paralleluniverse/galaxy
private Node getFirstNode() {
assert ordered;
synchronized (nodes) {
final Map.Entry<String, Node> entry = nodes.firstEntry();
return (entry != null ? entry.getValue() : null);
}
}
代码示例来源:origin: cinchapi/concourse
@Override
public Entry<T> firstEntry() {
return backing.firstEntry().getValue();
}
代码示例来源:origin: org.jclouds.api/nova
public URI getURI() {
if (orderedSelfReferences.isEmpty())
populateOrderedSelfReferences();
return orderedSelfReferences.firstEntry().getValue();
}
代码示例来源:origin: teiid/teiid
public V firstEntry(boolean poll) {
Map.Entry<CacheKey, V> entry = null;
if (poll) {
entry = evictionQueue.pollFirstEntry();
if (entry != null) {
int result = size.addAndGet(-1);
assert result >=0 || !isSuspectSize(size);
}
} else {
entry = evictionQueue.firstEntry();
}
if (entry != null) {
return entry.getValue();
}
return null;
}
代码示例来源:origin: org.teiid/teiid-engine
public V firstEntry(boolean poll) {
Map.Entry<CacheKey, V> entry = null;
if (poll) {
entry = evictionQueue.pollFirstEntry();
if (entry != null) {
int result = size.addAndGet(-1);
assert result >=0 || !isSuspectSize(size);
}
} else {
entry = evictionQueue.firstEntry();
}
if (entry != null) {
return entry.getValue();
}
return null;
}
代码示例来源:origin: org.jboss.teiid/teiid-engine
public V firstEntry(boolean poll) {
Map.Entry<CacheKey, V> entry = null;
if (poll) {
entry = evictionQueue.pollFirstEntry();
if (entry != null) {
int result = size.addAndGet(-1);
assert result >=0 || !isSuspectSize(size);
}
} else {
entry = evictionQueue.firstEntry();
}
if (entry != null) {
return entry.getValue();
}
return null;
}
代码示例来源: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> firstEntry() {
long[] stamps = grabAllSegmentWriteLocks();
try {
sort();
return sorted.firstEntry();
}
finally {
releaseSegmentLocks(stamps);
}
}
代码示例来源:origin: com.github.vladimir-bukhtoyarov/rolling-metrics
@Override
protected void updateConcurrently(long timestamp, long latencyTime, TimeUnit latencyUnit, Supplier<String> descriptionSupplier, long latencyNanos) {
Map.Entry<PositionKey, Position> firstEntry = positions.firstEntry();
PositionKey firstKey = firstEntry.getKey();
Position firstPosition = firstEntry.getValue();
long currentPhase = phaseSequence.get();
if (!isNeedToAdd(timestamp, latencyNanos, firstPosition, firstKey, currentPhase)) {
return;
}
Position position = new Position(timestamp, latencyTime, latencyUnit, descriptionSupplier, maxDescriptionLength);
if (positions.putIfAbsent(new PositionKey(currentPhase, position), position) == null) {
positions.pollFirstEntry();
}
}
代码示例来源:origin: vladimir-bukhtoyarov/rolling-metrics
@Override
protected void updateConcurrently(long timestamp, long latencyTime, TimeUnit latencyUnit, Supplier<String> descriptionSupplier, long latencyNanos) {
Map.Entry<PositionKey, Position> firstEntry = positions.firstEntry();
PositionKey firstKey = firstEntry.getKey();
Position firstPosition = firstEntry.getValue();
long currentPhase = phaseSequence.get();
if (!isNeedToAdd(timestamp, latencyNanos, firstPosition, firstKey, currentPhase)) {
return;
}
Position position = new Position(timestamp, latencyTime, latencyUnit, descriptionSupplier, maxDescriptionLength);
if (positions.putIfAbsent(new PositionKey(currentPhase, position), position) == null) {
positions.pollFirstEntry();
}
}
代码示例来源: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: org.apache.hbase/hbase-common
@Test
public void testFirstEntry() throws Exception {
assertEquals(csm.firstEntry().getKey(), m.firstEntry().getKey());
assertEquals(csm.firstEntry().getValue(), m.firstEntry().getValue());
assertEquals(csm.firstEntry(), m.firstEntry());
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
@Test
public void testFirstEntry() throws Exception {
assertEquals(csm.firstEntry().getKey(), m.firstEntry().getKey());
assertEquals(csm.firstEntry().getValue(), m.firstEntry().getValue());
assertEquals(csm.firstEntry(), m.firstEntry());
}
代码示例来源:origin: addthis/hydra
/**
* Helper method for {@link #getFirstKey()}.
*/
protected K firstKeyFastPath() {
Page<K, V> leftSentinel = getCache().firstEntry().getValue();
readLock(leftSentinel);
try {
if (leftSentinel.keys() == null) {
pullPageFromDisk(leftSentinel, LockMode.READMODE);
}
assert (!leftSentinel.inTransientState());
if (leftSentinel.size() > 0) {
return leftSentinel.keys().get(0);
}
} finally {
readUnlock(leftSentinel);
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!