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

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

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

ConcurrentSkipListMap.isEmpty介绍

[英]Returns true if this map contains no key-value mappings.
[中]如果此映射不包含键值映射,则返回true。

代码示例

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

public boolean hasRegionsInTransition() {
 return !regionInTransition.isEmpty();
}

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

@Override
public boolean isEmpty() {
  return skipListMap.isEmpty();
}

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

public boolean needMerge() {
  return !buffer.isEmpty();
}

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

@Override
public boolean isEmpty() {
  return buffer.isEmpty() && map.isEmpty();
}

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

public List<RegionState> getRegionFailedOpen() {
 if (regionFailedOpen.isEmpty()) return Collections.emptyList();
 ArrayList<RegionState> regions = new ArrayList<RegionState>(regionFailedOpen.size());
 for (RegionFailedOpen r: regionFailedOpen.values()) {
  regions.add(r.getRegionStateNode().toRegionState());
 }
 return regions;
}

代码示例来源:origin: Alluxio/alluxio

@Override
public boolean hasChildren(InodeDirectoryView inode) {
 Optional<Collection<Long>> cached = mListingCache.getCachedChildIds(inode.getId());
 if (cached.isPresent()) {
  return !cached.get().isEmpty();
 }
 return !mEdgeCache.getChildIds(inode.getId()).isEmpty() || mBackingStore.hasChildren(inode);
}

代码示例来源: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: apache/ignite

/**
 * @return Backup entries.
 */
@Nullable Collection<CacheContinuousQueryEntry> flushOnExchange() {
  TreeMap<Long, CacheContinuousQueryEntry> ret = null;
  int size = backupQ.sizex();
  if (size > 0) {
    ret = new TreeMap<>();
    for (int i = 0; i < size; i++) {
      CacheContinuousQueryEntry e = backupQ.pollFirst();
      if (e != null)
        ret.put(e.updateCounter(), e);
      else
        break;
    }
  }
  Batch batch = curBatch.get();
  if (batch != null)
    ret = batch.flushCurrentEntries(ret);
  if (!pending.isEmpty()) {
    if (ret == null)
      ret = new TreeMap<>();
    for (CacheContinuousQueryEntry e : pending.values())
      ret.put(e.updateCounter(), e);
  }
  return ret != null ? ret.values() : null;
}

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

try {
 int fileLocked = 0, fileUnlocked = 0, fileEvicted = 0, fileMoving = 0;
 if (e.getValue().getCache().isEmpty()) continue;
 List<LlapDataBuffer> lockedBufs = null;
 if (LlapIoImpl.LOCKING_LOGGER.isTraceEnabled()) {

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

@Override
public void stop()
{
 synchronized (lock) {
  if (currentlyProcessing != null) {
   executeCallbacks(currentlyProcessing.getCallbacks());
   currentlyProcessing = null;
  }
  if (!segmentsToDrop.isEmpty()) {
   for (SegmentHolder holder : segmentsToDrop.values()) {
    executeCallbacks(holder.getCallbacks());
   }
  }
  segmentsToDrop.clear();
  if (!segmentsToLoad.isEmpty()) {
   for (SegmentHolder holder : segmentsToLoad.values()) {
    executeCallbacks(holder.getCallbacks());
   }
  }
  segmentsToLoad.clear();
  queuedSize.set(0L);
  failedAssignCount.set(0);
  stopped = true;
 }
}

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

if (!segmentsToDrop.isEmpty()) {
 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());

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

@Override public void onEvent(Event evt) {
    int evtType = evt.type();
    assert evtType == EVT_NODE_FAILED || evtType == EVT_NODE_LEFT;
    if (affMap.isEmpty())
      return; // Skip empty affinity map.
    final DiscoveryEvent discoEvt = (DiscoveryEvent)evt;
    // Clean up affinity functions if such cache no more exists.
    final Collection<String> caches = ctx.cache().cacheNames();
    final Collection<AffinityAssignmentKey> rmv = new HashSet<>();
    for (AffinityAssignmentKey key : affMap.keySet()) {
      if (!caches.contains(key.cacheName) || key.topVer.topologyVersion() < discoEvt.topologyVersion() - 10)
        rmv.add(key);
    }
    if (!rmv.isEmpty()) {
      ctx.timeout().addTimeoutObject(
        new GridTimeoutObjectAdapter(
          IgniteUuid.fromUuid(ctx.localNodeId()),
          AFFINITY_MAP_CLEAN_UP_DELAY) {
            @Override public void onTimeout() {
              affMap.keySet().removeAll(rmv);
            }
          });
    }
  }
};

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

private void recover() {
  if (segments.isEmpty()) {
    return;

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

public LogSegment allocOrResetSegments(final long expectedOffset) {
  final long baseOffset = computeBaseOffset(expectedOffset);
  if (segments.isEmpty()) {
    return allocSegment(baseOffset);
  }
  if (nextSegmentBaseOffset() == baseOffset && latestSegment().isFull()) {
    return allocSegment(baseOffset);
  }
  LOG.warn("All segments are too old, need to delete all segment now. Current base offset: {}, expect base offset: {}",
      latestSegment().getBaseOffset(), baseOffset);
  deleteAllSegments();
  return allocSegment(baseOffset);
}

代码示例来源: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: palantir/atlasdb

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

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

/**
 * @return <code>true</code> if this branch contains any commits;
 *         <code>false</code> otherwise.
 */
boolean hasCommits() {
  return !commits.isEmpty();
}

代码示例来源:origin: co.cask.hbase/hbase

/**
 * @return True if regions in transition.
 */
public boolean isRegionsInTransition() {
 synchronized (this.regionsInTransition) {
  return !this.regionsInTransition.isEmpty();
 }
}

代码示例来源:origin: pravega/pravega

private void releaseIfEmptyInflight() {
  synchronized (lock) {
    if (inflight.isEmpty()) {
      log.trace("Inflight empty for writer {}", writerId);
      waitingInflight.release();
    }
  }
}

代码示例来源:origin: org.jclouds.api/nova

public URI getURI() {
 if (orderedSelfReferences.isEmpty())
   populateOrderedSelfReferences();
 return orderedSelfReferences.firstEntry().getValue();
}

相关文章

ConcurrentSkipListMap类方法