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

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

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

ScheduledExecutorService.invokeAny介绍

暂无

代码示例

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

@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
 return delegate.invokeAny(tasks);
}

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

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

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

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

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

@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
{
  return service.invokeAny(tasks);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@Test
public void invokeAny2() throws InterruptedException, ExecutionException, TimeoutException {
 underTest.invokeAny(callables, timeout, SECONDS);
 verify(executorService).invokeAny(callables, timeout, SECONDS);
}

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

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

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

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

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

public T call() throws Exception {
  _invokeEntryCount.incrementAndGet();
  try {
    return _current.get().invokeAny(tasks, timeout, unit);
  } finally {
    _invokeEntryCount.decrementAndGet();
  }
}

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

public T call() throws Exception {
  _invokeEntryCount.incrementAndGet();
  try {
    return _current.get().invokeAny(tasks, timeout, unit);
  } finally {
    _invokeEntryCount.decrementAndGet();
  }
}

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

@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks,
    long timeout, TimeUnit unit) throws InterruptedException,
    ExecutionException, TimeoutException {
  return getWrapped().invokeAny(tasks, timeout, unit);
}

代码示例来源:origin: com.twitter.common/util

@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
 return delegate.invokeAny(TaskConverter.alertingCallables(tasks, handler), timeout, unit);
}

代码示例来源:origin: com.twitter.common/util

@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
  throws InterruptedException, ExecutionException {
 return delegate.invokeAny(TaskConverter.alertingCallables(tasks, handler));
}

代码示例来源:origin: com.spotify.metrics/semantic-metrics-core

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

相关文章