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

x33g5p2x  于2022-01-23 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(141)

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

LinkedBlockingDeque.drainTo介绍

暂无

代码示例

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

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: MobiVM/robovm

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: ibinti/bugvm

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * @throws UnsupportedOperationException {@inheritDoc}
 * @throws ClassCastException            {@inheritDoc}
 * @throws NullPointerException          {@inheritDoc}
 * @throws IllegalArgumentException      {@inheritDoc}
 */
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: matomo-org/matomo-sdk-android

public void drainTo(List<Event> drainedEvents) {
  mQueue.drainTo(drainedEvents);
}

代码示例来源:origin: matomo-org/piwik-sdk-android

public void drainTo(List<Event> drainedEvents) {
  mQueue.drainTo(drainedEvents);
}

代码示例来源:origin: com.jtransc/jtransc-rt

@Override
public int drainTo(Collection<? super E> c) {
  return drainTo(c, Integer.MAX_VALUE);
}

代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client

private void cleanupFinishedOperations() {
 List<Long> toClean = new ArrayList<>();
 completedOperationIds.drainTo(toClean);
 if (!toClean.isEmpty()) {
  markOperationsCompleted(toClean);
 }
}

代码示例来源:origin: org.onap.dcaegen2.analytics.tca/dcae-analytics-dmaap

@Override
public synchronized List<String> getMessageForPublishing() {
  final List<String> recoveryMessageList = new LinkedList<>();
  final List<String> batchMessagesList = new LinkedList<>();
  // get messages from recovery queue if present
  if (!recoveryQueue.isEmpty()) {
    final int recoveryQueueSize = recoveryQueue.drainTo(recoveryMessageList);
    LOG.debug("Drained Recovery Queue elements for flushing: {}", recoveryQueueSize);
  }
  // get messages from batch queue if present
  if (!batchQueue.isEmpty()) {
    final int batchQueueSize = batchQueue.drainTo(batchMessagesList);
    LOG.debug("Drained Batch Queue elements for flushing: {}", batchQueueSize);
  }
  // concat recovery and batch queue elements
  return unmodifiableList(newLinkedList(concat(recoveryMessageList, batchMessagesList)));
}

代码示例来源:origin: com.graphaware.neo4j/writer

/**
 * {@inheritDoc}
 */
@Override
protected void runOneIteration() throws Exception {
  if (queue.isEmpty()) {
    return;
  }
  List<Collection<WriteOperation<?>>> tasks = new LinkedList<>();
  queue.drainTo(tasks);
  processOperations(tasks);
}

代码示例来源:origin: JetBrains/dekaf

public void disconnect() {
 myReady = false;
 while (!myAllConnections.isEmpty()) {
  sleep(11);
  //noinspection MismatchedQueryAndUpdateOfCollection
  final Collection<Connection> toClose = new ArrayList<Connection>(myConnectionsLimit);
  myFreeConnections.drainTo(toClose, 100);
  myAllConnections.removeAll(toClose);
  for (Connection connection : toClose) closeConnection(connection);
  toClose.clear();
 }
}

代码示例来源:origin: com.graphaware.neo4j/writer

/**
 * {@inheritDoc}
 */
@Override
protected final void runOneIteration() throws Exception {
  if (queue.isEmpty()) {
    return;
  }
  List<RunnableFuture<?>> tasks = new LinkedList<>();
  queue.drainTo(tasks);
  new IterableInputBatchTransactionExecutor<>(database, batchSize, tasks, new UnitOfWork<RunnableFuture<?>>() {
    @Override
    public void execute(GraphDatabaseService database, RunnableFuture<?> input, int batchNumber, int stepNumber) {
      processInput(input);
    }
  }).execute();
}

代码示例来源:origin: matomo-org/piwik-sdk-android

public boolean updateState(boolean online) {
  if (online) {
    final List<Event> uncache = mDiskCache.uncache();
    ListIterator<Event> it = uncache.listIterator(uncache.size());
    while (it.hasPrevious()) {
      // Anything from  disk cache is older then what the queue could currently contain.
      mQueue.offerFirst(it.previous());
    }
    Timber.tag(TAG).d("Switched state to ONLINE, uncached %d events from disk.", uncache.size());
  } else if (!mQueue.isEmpty()) {
    List<Event> toCache = new ArrayList<>();
    mQueue.drainTo(toCache);
    mDiskCache.cache(toCache);
    Timber.tag(TAG).d("Switched state to OFFLINE, caching %d events to disk.", toCache.size());
  }
  return online && !mQueue.isEmpty();
}

代码示例来源:origin: matomo-org/matomo-sdk-android

public boolean updateState(boolean online) {
  if (online) {
    final List<Event> uncache = mDiskCache.uncache();
    ListIterator<Event> it = uncache.listIterator(uncache.size());
    while (it.hasPrevious()) {
      // Anything from  disk cache is older then what the queue could currently contain.
      mQueue.offerFirst(it.previous());
    }
    Timber.tag(TAG).d("Switched state to ONLINE, uncached %d events from disk.", uncache.size());
  } else if (!mQueue.isEmpty()) {
    List<Event> toCache = new ArrayList<>();
    mQueue.drainTo(toCache);
    mDiskCache.cache(toCache);
    Timber.tag(TAG).d("Switched state to OFFLINE, caching %d events to disk.", toCache.size());
  }
  return online && !mQueue.isEmpty();
}

相关文章

微信公众号

最新文章

更多