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

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(132)

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

ScheduledExecutorService.invokeAll介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
 return delegate.invokeAll(tasks, timeout, unit);
}

代码示例来源:origin: SonarSource/sonarqube

@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
 return delegate.invokeAll(tasks);
}

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

@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
{
  return service.invokeAll(tasks);
}

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

@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
{
  return service.invokeAll(tasks, timeout, unit);
}

代码示例来源:origin: alibaba/nacos

private void processTask() throws Exception {
  Collection<Callable<Void>> tasks = new LinkedList<Callable<Void>>();
  do {
    Beat beat = taskQueue.poll(AbstractHealthCheckProcessor.CONNECT_TIMEOUT_MS / 2, TimeUnit.MILLISECONDS);
    if (beat == null) {
      return;
    }
    tasks.add(new TaskProcessor(beat));
  } while (taskQueue.size() > 0 && tasks.size() < NIO_THREAD_COUNT * 64);
  for (Future<?> f : NIO_EXECUTOR.invokeAll(tasks)) {
    f.get();
  }
}

代码示例来源:origin: prestodb/presto

private void awaitAsynchronousCallbacksRun()
    throws Exception
{
  // Make sure asynchronous callback got called (executor is single-threaded).
  executor.invokeAll(singletonList((Callable<?>) () -> null));
}

代码示例来源:origin: io.dropwizard.metrics/metrics-core

/**
 * {@inheritDoc}
 */
@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
  submitted.mark(tasks.size());
  Collection<? extends Callable<T>> instrumented = instrument(tasks);
  return delegate.invokeAll(instrumented, timeout, unit);
}

代码示例来源:origin: io.dropwizard.metrics/metrics-core

/**
 * {@inheritDoc}
 */
@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
  submitted.mark(tasks.size());
  Collection<? extends Callable<T>> instrumented = instrument(tasks);
  return delegate.invokeAll(instrumented);
}

代码示例来源:origin: networknt/light-4j

/**
 * {@inheritDoc}
 */
@Nonnull
@Override
public <T> List<Future<T>> invokeAll(@Nonnull Collection<? extends Callable<T>> tasks, long timeout, @Nonnull TimeUnit unit) throws InterruptedException {
  submitted.mark(tasks.size());
  Collection<? extends Callable<T>> instrumented = instrument(tasks);
  return delegate.invokeAll(instrumented, timeout, unit);
}

代码示例来源:origin: networknt/light-4j

/**
 * {@inheritDoc}
 */
@Nonnull
@Override
public <T> List<Future<T>> invokeAll(@Nonnull Collection<? extends Callable<T>> tasks) throws InterruptedException {
  submitted.mark(tasks.size());
  Collection<? extends Callable<T>> instrumented = instrument(tasks);
  return delegate.invokeAll(instrumented);
}

代码示例来源:origin: spring-projects/spring-security

@Test
@SuppressWarnings("unchecked")
public void invokeAllTimeout() throws Exception {
  List<Future<Object>> exectedResult = Arrays.asList(expectedFutureObject);
  List<Callable<Object>> wrappedCallables = Arrays.asList(wrappedCallable);
  when(delegate.invokeAll(wrappedCallables, 1, TimeUnit.SECONDS)).thenReturn(
      exectedResult);
  List<Future<Object>> result = executor.invokeAll(Arrays.asList(callable), 1,
      TimeUnit.SECONDS);
  verify(delegate).invokeAll(wrappedCallables, 1, TimeUnit.SECONDS);
  assertThat(result).isEqualTo(exectedResult);
}

代码示例来源:origin: spring-projects/spring-security

@Test
@SuppressWarnings("unchecked")
public void invokeAll() throws Exception {
  List<Future<Object>> exectedResult = Arrays.asList(expectedFutureObject);
  List<Callable<Object>> wrappedCallables = Arrays.asList(wrappedCallable);
  when(delegate.invokeAll(wrappedCallables)).thenReturn(exectedResult);
  List<Future<Object>> result = executor.invokeAll(Arrays.asList(callable));
  verify(delegate).invokeAll(wrappedCallables);
  assertThat(result).isEqualTo(exectedResult);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void invokeAll1() throws InterruptedException {
 underTest.invokeAll(callables, timeout, SECONDS);
 verify(executorService).invokeAll(callables, timeout, SECONDS);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void invokeAll() throws InterruptedException {
 underTest.invokeAll(callables);
 verify(executorService).invokeAll(callables);
}

代码示例来源:origin: facebook/jcommon

@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
 throws InterruptedException {
 List<TrackedCallable<T>> trackedTaskList = 
  executorCore.registerCallableList(tasks);
 return executorCore.trackFutureList(
  executor.invokeAll(trackedTaskList), trackedTaskList
 );
}

代码示例来源:origin: facebook/jcommon

@Override
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
 throws InterruptedException {
 List<TrackedCallable<T>> trackedTaskList = 
  executorCore.registerCallableList(tasks);
 return executorCore.trackFutureList(
  executor.invokeAll(trackedTaskList, timeout, unit), trackedTaskList
 );
}

代码示例来源:origin: org.restlet.osgi/org.restlet

@SuppressWarnings({ "rawtypes", "unchecked" })
public List invokeAll(Collection tasks, long timeout, TimeUnit unit)
    throws InterruptedException {
  return executorService.invokeAll(tasks, timeout, unit);
}

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

public List<Future<T>> call() throws Exception {
  _invokeEntryCount.incrementAndGet();
  try {
    return _current.get().invokeAll(tasks);
  } finally {
    _invokeEntryCount.decrementAndGet();
  }
}

代码示例来源:origin: org.apache.aries.blueprint/org.apache.aries.blueprint.core

public List<Future<T>> call() throws Exception {
  _invokeEntryCount.incrementAndGet();
  try {
    return _current.get().invokeAll(tasks, timeout, unit);
  } finally {
    _invokeEntryCount.decrementAndGet();
  }
}

代码示例来源:origin: com.networknt/metrics

/**
 * {@inheritDoc}
 */
@Nonnull
@Override
public <T> List<Future<T>> invokeAll(@Nonnull Collection<? extends Callable<T>> tasks) throws InterruptedException {
  submitted.mark(tasks.size());
  Collection<? extends Callable<T>> instrumented = instrument(tasks);
  return delegate.invokeAll(instrumented);
}

相关文章