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

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

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

FutureTask.report介绍

[英]Returns result or throws exception for completed task.
[中]返回已完成任务的结果或引发异常。

代码示例

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get() throws InterruptedException, ExecutionException {
  int s = state;
  if (s <= COMPLETING)
    s = awaitDone(false, 0L);
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get(long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
  if (unit == null)
    throw new NullPointerException();
  int s = state;
  if (s <= COMPLETING &&
    (s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
    throw new TimeoutException();
  return report(s);
}

代码示例来源:origin: stackoverflow.com

Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.RuntimeException: This is a failure!
  at java.util.concurrent.FutureTask.report(FutureTask.java:122)
  at java.util.concurrent.FutureTask.get(FutureTask.java:192)
  at Ideone.main(Main.java:16)
Caused by: java.lang.RuntimeException: This is a failure!
  at Ideone$SampleCallable.call(Main.java:21)
  at Ideone$SampleCallable.call(Main.java:19)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at Ideone.main(Main.java:14)

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get() throws InterruptedException, ExecutionException {
  int s = state;
  if (s <= COMPLETING)
    s = awaitDone(false, 0L);
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get(long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
  if (unit == null)
    throw new NullPointerException();
  int s = state;
  if (s <= COMPLETING &&
    (s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
    throw new TimeoutException();
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get() throws InterruptedException, ExecutionException {
  int s = state;
  if (s <= COMPLETING)
    s = awaitDone(false, 0L);
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get() throws InterruptedException, ExecutionException {
  int s = state;
  if (s <= COMPLETING)
    s = awaitDone(false, 0L);
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get() throws InterruptedException, ExecutionException {
  int s = state;
  if (s <= COMPLETING)
    s = awaitDone(false, 0L);
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get() throws InterruptedException, ExecutionException {
  int s = state;
  if (s <= COMPLETING)
    s = awaitDone(false, 0L);
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get(long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
  if (unit == null)
    throw new NullPointerException();
  int s = state;
  if (s <= COMPLETING &&
    (s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
    throw new TimeoutException();
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get() throws InterruptedException, ExecutionException {
  int s = state;
  if (s <= COMPLETING)
    s = awaitDone(false, 0L);
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get(long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
  if (unit == null)
    throw new NullPointerException();
  int s = state;
  if (s <= COMPLETING &&
    (s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
    throw new TimeoutException();
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get(long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
  if (unit == null)
    throw new NullPointerException();
  int s = state;
  if (s <= COMPLETING &&
    (s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
    throw new TimeoutException();
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get(long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
  if (unit == null)
    throw new NullPointerException();
  int s = state;
  if (s <= COMPLETING &&
    (s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
    throw new TimeoutException();
  return report(s);
}

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

/**
 * @throws CancellationException {@inheritDoc}
 */
public V get(long timeout, TimeUnit unit)
  throws InterruptedException, ExecutionException, TimeoutException {
  if (unit == null)
    throw new NullPointerException();
  int s = state;
  if (s <= COMPLETING &&
    (s = awaitDone(true, unit.toNanos(timeout))) <= COMPLETING)
    throw new TimeoutException();
  return report(s);
}

代码示例来源:origin: stackoverflow.com

java CallableDemo
creating service
Start
future.isDone = true
java.util.concurrent.ExecutionException: java.lang.ArithmeticException: / by zero
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at CallableDemo.<init>(CallableDemo.java:19)
    at CallableDemo.main(CallableDemo.java:27)
Caused by: java.lang.ArithmeticException: / by zero
    at CallableDemo$MyCallable.call(CallableDemo.java:36)
    at CallableDemo$MyCallable.call(CallableDemo.java:29)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

代码示例来源:origin: stackoverflow.com

future.isDone = true
java.util.concurrent.ExecutionException: java.lang.ArithmeticException: / by zero
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at InvokeAllUsage.<init>(InvokeAllUsage.java:20)
future.isDone = true
java.util.concurrent.ExecutionException: java.lang.ArithmeticException: / by zero
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:188)
    at InvokeAllUsage.<init>(InvokeAllUsage.java:20)

代码示例来源:origin: stackoverflow.com

Exeuction exception:
java.util.concurrent.ExecutionException: java.lang.ArithmeticException: / by zero
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:202)
    at ExceptionDemo.main(ExceptionDemo.java:20)

相关文章