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

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

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

FutureTask.setException介绍

[英]Causes this future to report an ExecutionExceptionwith the given throwable as its cause, unless this future has already been set or has been cancelled.

This method is invoked internally by the #run method upon failure of the computation.
[中]导致此未来报告一个ExecutionException,其原因为给定的throwable,除非此未来已设置或已取消。
当计算失败时,#run方法在内部调用此方法。

代码示例

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

@Override
public void setException(final Throwable e) {
  super.setException(e);
}

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

setException(ex);

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

result = null;
ran = false;
setException(ex);

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

@Override
public void setException(Throwable t) {
  super.setException(t);
}

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

@Override
protected void setException(Throwable e) {
  if (!(this.status == TaskStatus.CANCELLED &&
     e instanceof InterruptedException)) {
    LOG.warn("An exception occurred when running task: {}",
         this.id(), e);
    // Update status to FAILED if exception occurred(not interrupted)
    this.status(TaskStatus.FAILED);
    this.result = e.toString();
  }
  super.setException(e);
}

代码示例来源:origin: org.glassfish/javax.enterprise.concurrent

@Override
protected void setException(Throwable t) {
  super.setException(t);
  taskRunThrowable = t;
}

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-zeromq

@Override
  protected void setException(Throwable t) {
    super.setException(t);
  }
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-binding-zeromq

@Override
  protected void setException(Throwable t) {
    super.setException(t);
  }
}

代码示例来源:origin: apache/activemq-artemis

protected void setException(Throwable t) {
    super.setException(t);
  }
}

代码示例来源:origin: apache/activemq-artemis

protected void setException(Throwable t) {
    super.setException(t);
  }
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

protected void setException(Throwable t) {
    super.setException(t);
  }
}

代码示例来源:origin: org.gridkit.lab/jvm-attach-api

@Override
  public void setException(Throwable t) {
    super.setException(t);
  }
}

代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc

protected void setException(Throwable t) {
    super.setException(t);
  }
}

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

protected void setException(Throwable t) {
    super.setException(t);
  }
}

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

@Override
 protected void setException(Throwable t) {
  super.setException(t);
  System.err.println("Uncaught Exception ");
  t.printStackTrace();
 }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-extexecution-base

@Override
protected void setException(Throwable t) {
  if (t instanceof WrappedException) {
    super.setException(((WrappedException) t).getCause());
  } else {
    super.setException(t);
  }
}

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

@Override
 protected void setException(Throwable t) {
  super.setException(t);
  System.err.println("Uncaught Exception ");
  t.printStackTrace();
 }
}

代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin

public void set(DataByteArrayInputStream source) throws IOException, ClassNotFoundException {
  try {
    serializationStrategy.decodeResponse(loader, method.getReturnType(), source, this);
  } catch (Throwable e) {
    super.setException(e);
  }
}

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

java.lang.RuntimeException: An error occured while executing doInBackground()
     at android.os.AsyncTask$3.done(AsyncTask.java:300)
     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
     at java.lang.Thread.run(Thread.java:841)
  Caused by: java.lang.IllegalStateException: Already connected
     at java.net.URLConnection.checkNotConnected(URLConnection.java:464)
     at java.net.URLConnection.setDoOutput(URLConnection.java:878)

代码示例来源:origin: com.baidu.hugegraph/hugegraph-core

@Override
protected void setException(Throwable e) {
  if (!(this.status == TaskStatus.CANCELLED &&
     e instanceof InterruptedException)) {
    LOG.warn("An exception occurred when running task: {}",
         this.id(), e);
    // Update status to FAILED if exception occurred(not interrupted)
    this.status(TaskStatus.FAILED);
    this.result = e.toString();
  }
  super.setException(e);
}

相关文章