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

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

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

ConcurrentSkipListMap.lastKey介绍

暂无

代码示例

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

@Override
public K lastKey() {
  try {
    return skipListMap.lastKey();
  } catch (NoSuchElementException e) {
    return null;
  }
}

代码示例来源:origin: qunarcorp/qmq

@Override
public boolean clean(Long key) {
  if (segments.isEmpty()) return false;
  if (segments.lastKey() < key) return false;
  DelaySegment segment = segments.remove(key);
  if (null == segment) {
    LOGGER.error("clean delay segment log failed,segment:{}", logDir, key);
    return false;
  }
  if (!segment.destroy()) {
    LOGGER.warn("remove delay segment failed.segment:{}", segment);
    return false;
  }
  LOGGER.info("remove delay segment success.segment:{}", segment);
  return true;
}

代码示例来源:origin: loklak/loklak_server

public Track(String servlet, String clientHost, String referrer) {
  this.clientHost = clientHost;
  long time = System.currentTimeMillis();
  Date lastDate = null;
  try {lastDate = AccessTracker.this.pendingQueue.lastKey();} catch (NoSuchElementException e) {}
  long last = lastDate == null ? time - 1 : lastDate.getTime();
  if (time <= last) time = last + 1;
  this.accessTime = new Date(time);
  this.put(START_DATE_KEY, DateParser.iso8601MillisFormat.format(accessTime));
  this.put(CLIENT_KEY, clientHost);
  this.isLocalhost = RemoteAccess.isLocalhost(clientHost, referrer);
  this.put(LOCALHOST_FLAG, this.isLocalhost);
  AccessTracker.this.pendingQueue.put(accessTime, this);
}

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

@Test
public void testLastKey() throws Exception {
 assertEquals(csm.lastKey(), m.lastKey());
}

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

protected K getFirstLast(boolean first) {
  Object k, k1, k2;
  try {
    if (first)
      k1 = buffer.firstKey();
    else
      k1 = buffer.lastKey();
  } catch (NoSuchElementException e) {
    k1 = null;
  }
  if (first)
    k2 = map.firstKey();
  else
    k2 = map.lastKey();
  if (k1 == null)
    k = k2;
  else if (k2 == null)
    k = k1;
  else {
    if (first)
      k = getKeyType().compare(k1, k2) < 0 ? k1 : k2;
    else
      k = getKeyType().compare(k1, k2) < 0 ? k2 : k1;
  }
  return (K) k;
}

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

@Override
public long getLatestSequencePreparedOrAccepted() {
  if (state.isEmpty()) {
    return greatestInLogAtStartup;
  } else {
    return Math.max(greatestInLogAtStartup, state.lastKey());
  }
}

代码示例来源:origin: sc.fiji/TrackMate_

/**
 * Returns the last (highest) frame currently in this collection.
 *
 * @return the last (highest) frame currently in this collection.
 */
public Integer lastKey()
{
  if ( content.isEmpty() ) { return 0; }
  return content.lastKey();
}

代码示例来源:origin: Unidata/thredds

private void removeFromCache(int count) {
 int done = 0;
 while (count > done) {
  CacheElement elem = shadowCache.lastKey();
  done += elem.list.size();
  expireFromCache(elem);
 }
}

代码示例来源:origin: com.palantir.atlasdb/leader-election-impl

@Override
public long getLatestSequencePreparedOrAccepted() {
  if (state.isEmpty()) {
    return greatestInLogAtStartup;
  } else {
    return Math.max(greatestInLogAtStartup, state.lastKey());
  }
}

代码示例来源:origin: edu.ucar/cdm

private void removeFromCache(int count) {
 int done = 0;
 while (count > done) {
  CacheElement elem = shadowCache.lastKey();
  done += elem.list.size();
  expireFromCache(elem);
 }
}

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

private int getNewPriority(int start) {
 if (!rolePriorityMap.containsKey(start)) {
  return start;
 }
 return rolePriorityMap.lastKey() + 1;
}

代码示例来源:origin: apache/incubator-slider

private int getNewPriority(int start) {
 if (!rolePriorityMap.containsKey(start)) {
  return start;
 }
 return rolePriorityMap.lastKey() + 1;
}

代码示例来源:origin: fiji/TrackMate

/**
 * Returns the last (highest) frame currently in this collection.
 *
 * @return the last (highest) frame currently in this collection.
 */
public Integer lastKey()
{
  if ( content.isEmpty() ) { return 0; }
  return content.lastKey();
}

代码示例来源:origin: apache/jackrabbit-oak

/**
 * @param rev the revision to check.
 * @return {@code true} if the given revision is the head of this branch,
 *          {@code false} otherwise.
 */
public boolean isHead(@NotNull Revision rev) {
  checkArgument(checkNotNull(rev).isBranch(),
      "Not a branch revision: %s", rev);
  return checkNotNull(rev).equals(commits.lastKey());
}

代码示例来源:origin: org.apache.jackrabbit/oak-store-document

/**
 * @param rev the revision to check.
 * @return {@code true} if the given revision is the head of this branch,
 *          {@code false} otherwise.
 */
public boolean isHead(@NotNull Revision rev) {
  checkArgument(checkNotNull(rev).isBranch(),
      "Not a branch revision: %s", rev);
  return checkNotNull(rev).equals(commits.lastKey());
}

代码示例来源:origin: org.apache.jackrabbit/oak-store-document

/**
 * Adds a new commit with revision <code>r</code> to this branch.
 *
 * @param r the revision of the branch commit to add.
 * @throws IllegalArgumentException if r is not a branch revision.
 */
void addCommit(@NotNull Revision r) {
  checkArgument(checkNotNull(r).isBranch(), "Not a branch revision: %s", r);
  Revision last = commits.lastKey();
  checkArgument(commits.comparator().compare(r, last) > 0);
  commits.put(r, new BranchCommitImpl(commits.get(last).getBase(), r));
}

代码示例来源:origin: apache/jackrabbit-oak

/**
 * Adds a new commit with revision <code>r</code> to this branch.
 *
 * @param r the revision of the branch commit to add.
 * @throws IllegalArgumentException if r is not a branch revision.
 */
void addCommit(@NotNull Revision r) {
  checkArgument(checkNotNull(r).isBranch(), "Not a branch revision: %s", r);
  Revision last = commits.lastKey();
  checkArgument(commits.comparator().compare(r, last) > 0);
  commits.put(r, new BranchCommitImpl(commits.get(last).getBase(), r));
}

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

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

代码示例来源:origin: org.glassfish.main.elasticity/elastic-api

private NavigableMap<Long, MetricEntryHolder> getOldestView(long duration, TimeUnit unit) {
  NavigableMap<Long, MetricEntryHolder> result = _emptyMap;
  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(map.firstKey(), true, minKey, true);
      }
    }
  }
  
  return result;
}

代码示例来源:origin: org.apache.hbase/hbase-common

@Test
public void testLastKey() throws Exception {
 assertEquals(csm.lastKey(), m.lastKey());
}

相关文章

ConcurrentSkipListMap类方法