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

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

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

ConcurrentSkipListSet.isEmpty介绍

[英]Returns true if this set contains no elements.
[中]如果此集合不包含任何元素,则返回true。

代码示例

代码示例来源:origin: ehcache/ehcache3

/**
 * Checks weather non-contiguous message ids set is empty.
 *
 * @return true if the there is no non contiguous message ids otherwise false
 */
public boolean isEmpty() {
 return nonContiguousMsgIds.isEmpty();
}

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

/**
 * Check if there are locally pending messages to consume.
 *
 * @return true if there are some; false otherwise.
 */
private boolean hasMessagesPending()
{
 for (Map.Entry<MessageQueue, ConcurrentSkipListSet<MessageExt>> entry : messageQueueTreeSetMap.entrySet()) {
  if (!entry.getValue().isEmpty()) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: Graylog2/graylog2-server

@Override
  public void run() {
    try {
      // loop until we've either evicted all outdated chunk entries, or the set is completely empty.
      // this task will run every second by default (see constant in constructor)
      while (true) {
        // Check if eviction set is empty to avoid a NoElementException when calling first().
        if (sortedEvictionSet.isEmpty()) {
          break;
        }
        final ChunkEntry oldestChunkEntry = sortedEvictionSet.first();
        if (isOutdated(oldestChunkEntry)) {
          expireEntry(oldestChunkEntry.id);
        } else {
          log.debug("No more outdated chunk entries found to evict, leaving cleanup loop.");
          break;
        }
      }
    } catch (Exception e) {
      // Make sure to never throw an exception out of this runnable, it's being run in an executor.
      log.warn("Error while expiring GELF chunk entries", e);
    }
  }
}

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

@Nullable
@Override
public InputRow nextRow()
{
 if (nextIterator.hasNext()) {
  return nextIterator.next();
 }
 for (Map.Entry<MessageQueue, ConcurrentSkipListSet<MessageExt>> entry : messageQueueTreeSetMap.entrySet()) {
  if (!entry.getValue().isEmpty()) {
   MessageExt message = entry.getValue().pollFirst();
   nextIterator = theParser.parseBatch(ByteBuffer.wrap(message.getBody())).iterator();
   windows
     .computeIfAbsent(entry.getKey(), k -> new ConcurrentSkipListSet<>())
     .add(message.getQueueOffset());
   return nextIterator.next();
  }
 }
 // should never happen.
 throw new RuntimeException("Unexpected Fatal Error! There should have been one row available.");
}

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

for (MessageQueue messageQueue : entry.getValue()) {
 ConcurrentSkipListSet<MessageExt> messages = messageQueueTreeSetMap.get(messageQueue);
 if (messages != null && !messages.isEmpty()) {
  hasMore = true;
 } else {

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

/**
 * Make sure that no partitions were extracted.
 */
private static void assertNoPartitions() {
  assertTrue("No requests were sent.", INTERCEPTED_REQS.get() > 0);
  assertTrue("Partitions are not empty: " + INTERCEPTED_PARTS, INTERCEPTED_PARTS.isEmpty());
}

代码示例来源:origin: linkedin/parseq

while (_runningProcesses.size() < _parallelizationLevel && !_processRequestQueue.isEmpty()) {
 ProcessRequest request = _processRequestQueue.pollFirst();
 if (request != null) {

代码示例来源:origin: ehcache/ehcache3

/**
 * Remove the contiguous seen msgIds from the nonContiguousMsgIds and update highestContiguousMsgId
 */
private void reconcile() {
 // If nonContiguousMsgIds is empty then nothing to reconcile.
 if (nonContiguousMsgIds.isEmpty()) {
  return;
 }
 // This happens when a passive is started after Active has moved on and
 // passive starts to see msgIDs starting from a number > 0.
 // Once the sync is completed, fast forward highestContiguousMsgId.
 // Post sync completion assuming platform will send all msgIds beyond highestContiguousMsgId.
 if (highestContiguousMsgId == -1L && isSyncCompleted) {
  Long min = nonContiguousMsgIds.last();
  LOGGER.info("Setting highestContiguousMsgId to {} from -1", min);
  highestContiguousMsgId = min;
  nonContiguousMsgIds.removeIf(msgId -> msgId <= min);
 }
 for (long msgId : nonContiguousMsgIds) {
  if (msgId <= highestContiguousMsgId) {
   nonContiguousMsgIds.remove(msgId);
  } else if (msgId > highestContiguousMsgId + 1) {
   break;
  } else {
   // the order is important..
   highestContiguousMsgId = msgId;
   nonContiguousMsgIds.remove(msgId);
  }
 }
}

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

if (!pendingIndividualAcks.isEmpty()) {
  if (Commands.peerSupportsMultiMessageAcknowledgment(cnx.getRemoteEndpointProtocolVersion())) {

代码示例来源:origin: camunda/camunda-bpm-platform

Assert.assertTrue(duplicatedIds.isEmpty());

代码示例来源:origin: de.dentrassi.eclipse.neoscada.utils/org.eclipse.scada.utils

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

代码示例来源:origin: com.n3twork.druid/druid-server

public boolean isEmpty()
{
 return segmentsHolder.isEmpty();
}

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

@Override
public boolean isQueueEmpty() {
 assertNotKilled();
 return queue.isEmpty();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

public void checkForDeactivation() {
 if (schedulerKeys.isEmpty()) {
  abstractUsersManager.deactivateApplication(user, applicationId);
 }
}

代码示例来源:origin: kontalk/tigase-server

protected static void initGlobalTrustedJids() {
  String trustedJidsStr = System.getProperty("trusted");
  if (trustedJidsStr == null || trustedJidsStr.isEmpty())
    GLOBAL_TRUSTED_JIDS = null;
  else {
    ConcurrentSkipListSet<String> trusted = new ConcurrentSkipListSet<>();
    for (String trustedStr : trustedJidsStr.split(",")) {
      if (!trustedStr.contains("{"))
        trusted.add(trustedStr);
    }
    if (trusted.isEmpty())
      GLOBAL_TRUSTED_JIDS = null;
    else
      GLOBAL_TRUSTED_JIDS = trusted;
  }
}

代码示例来源:origin: io.snappydata/gemfire-core

Hoplog getOldestHoplog() {
 if (hoplogs.isEmpty()) {
  return null;
 }
 return hoplogs.last().get();
}

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

Hoplog getOldestHoplog() {
 if (hoplogs.isEmpty()) {
  return null;
 }
 return hoplogs.last().get();
}

代码示例来源:origin: jsevellec/cassandra-unit

public RangeIterator<Long, Token> search(Expression expression)
{
  ByteBuffer prefix = expression.lower == null ? null : expression.lower.value;
  Iterable<ConcurrentSkipListSet<DecoratedKey>> search = search(expression.getOp(), definition.cellValueType().getString(prefix));
  RangeUnionIterator.Builder<Long, Token> builder = RangeUnionIterator.builder();
  for (ConcurrentSkipListSet<DecoratedKey> keys : search)
  {
    if (!keys.isEmpty())
      builder.add(new KeyRangeIterator(keys));
  }
  return builder.build();
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public RangeIterator<Long, Token> search(Expression expression)
{
  ByteBuffer prefix = expression.lower == null ? null : expression.lower.value;
  Iterable<ConcurrentSkipListSet<DecoratedKey>> search = search(expression.getOp(), definition.cellValueType().getString(prefix));
  RangeUnionIterator.Builder<Long, Token> builder = RangeUnionIterator.builder();
  for (ConcurrentSkipListSet<DecoratedKey> keys : search)
  {
    if (!keys.isEmpty())
      builder.add(new KeyRangeIterator(keys));
  }
  return builder.build();
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public RangeIterator<Long, Token> search(Expression expression)
{
  ByteBuffer prefix = expression.lower == null ? null : expression.lower.value;
  Iterable<ConcurrentSkipListSet<DecoratedKey>> search = search(expression.getOp(), definition.cellValueType().getString(prefix));
  RangeUnionIterator.Builder<Long, Token> builder = RangeUnionIterator.builder();
  for (ConcurrentSkipListSet<DecoratedKey> keys : search)
  {
    if (!keys.isEmpty())
      builder.add(new KeyRangeIterator(keys));
  }
  return builder.build();
}

相关文章

微信公众号

最新文章

更多