本文整理了Java中java.util.concurrent.FutureTask.isDone()
方法的一些代码示例,展示了FutureTask.isDone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FutureTask.isDone()
方法的具体详情如下:
包路径:java.util.concurrent.FutureTask
类名称:FutureTask
方法名:isDone
暂无
代码示例来源:origin: QNJR-GROUP/EasyTransaction
@Override
public boolean isDone() {
return futureTask.isDone();
}
代码示例来源:origin: airbnb/lottie-android
@Override public void run() {
while (true) {
if (isInterrupted() || taskComplete) {
return;
}
if (task.isDone()) {
try {
setResult(task.get());
} catch (InterruptedException | ExecutionException e) {
setResult(new LottieResult<T>(e));
}
taskComplete = true;
stopTaskObserverIfNeeded();
}
}
}
};
代码示例来源:origin: apache/nifi
final FutureTask<?> task = (FutureTask<?>) runnable;
try {
if (task.isDone()) {
if (task.isCancelled()) {
if (logger.isDebugEnabled()) {
代码示例来源:origin: facebook/litho
LithoAffinityBooster booster = null;
if (isMainThread() && !futureTask.isDone() && runningThreadId != Process.myTid()) {
代码示例来源:origin: MovingBlocks/Terasology
@Override
public void update(float delta) {
super.update(delta);
if (parallelTask == null) {
return; // idle
}
if (!parallelTask.isDone()) {
return; // still running
}
if (parallelTask.isCancelled()) {
// wait for the thread to die
if (!thread.isAlive()) {
getManager().popScreen();
}
return;
}
try {
T result = parallelTask.get();
getManager().popScreen();
if (resultEvent != null) {
resultEvent.accept(result);
}
} catch (InterruptedException | ExecutionException e) {
logger.warn("An error occurred during execution", e);
getManager().popScreen();
getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error", e.getMessage());
}
}
代码示例来源:origin: spring-projects/spring-batch
if (systemCommandTask.isDone()) {
contribution.setExitStatus(systemProcessExitCodeMapper.getExitStatus(systemCommandTask.get()));
return RepeatStatus.FINISHED;
代码示例来源:origin: ebean-orm/ebean
@Override
public boolean isDone() {
return futureTask.isDone();
}
代码示例来源:origin: foxinmy/weixin4j
@Override
public boolean isDone() {
return this.futureTask.isDone();
}
代码示例来源:origin: jankotek/mapdb
if (stock) assertTrue(!((FutureTask) recorder.r).isDone());
assertSame(p, recorder.p);
if (stock) assertTrue(!((FutureTask) recorder.r).isDone());
assertSame(p, recorder.p);
if (stock) assertTrue(!((FutureTask) recorder.r).isDone());
assertSame(p, recorder.p);
future = s.schedule(r, randomTimeout(), randomTimeUnit());
assertFalse(future.isDone());
if (stock) assertTrue(!((FutureTask) recorder.r).isDone());
assertSame(p, recorder.p);
future = s.schedule(c, randomTimeout(), randomTimeUnit());
assertFalse(future.isDone());
if (stock) assertTrue(!((FutureTask) recorder.r).isDone());
assertSame(p, recorder.p);
future = s.scheduleAtFixedRate(r, randomTimeout(), LONG_DELAY_MS, MILLISECONDS);
assertFalse(future.isDone());
if (stock) assertTrue(!((FutureTask) recorder.r).isDone());
assertSame(p, recorder.p);
future = s.scheduleWithFixedDelay(r, randomTimeout(), LONG_DELAY_MS, MILLISECONDS);
assertFalse(future.isDone());
if (stock) assertTrue(!((FutureTask) recorder.r).isDone());
assertSame(p, recorder.p);
代码示例来源:origin: pentaho/mondrian
public void run() {
for (final Pair<FutureTask<Result>, Execution> task
: tasks)
{
if (task.left.isDone()) {
tasks.remove(task);
continue;
}
if (task.right.isCancelOrTimeout()) {
// Remove it from the list so that we know
// it was cleaned once.
tasks.remove(task);
// Cancel the FutureTask for which
// the user thread awaits. The user
// thread will call
// Execution.checkCancelOrTimeout
// later and take care of sending
// an exception on the user thread.
task.left.cancel(false);
}
}
}
},
代码示例来源:origin: hcoles/pitest
@Override
public void execute(final ResultCollector rc) {
final long maxTime = this.timeOutStrategy
.getAllowedTime(this.executionTime);
final FutureTask<?> future = createFutureForChildTestUnit(rc);
executeFutureWithTimeOut(maxTime, future, rc);
if (!future.isDone()) {
this.timeOutSideEffect.apply();
}
}
代码示例来源:origin: stackoverflow.com
return this.task.isDone();
代码示例来源:origin: xSAVIKx/AndroidScreencast
/**
* {@inheritDoc}
*/
@Override
public final boolean isDone() {
return future.isDone();
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* {@inheritDoc}
*/
public final boolean isDone() {
return future.isDone();
}
代码示例来源:origin: com.blazegraph/bigdata-core
@Override
public boolean isRunning() {
final FutureTask<Void> ft = gangliaFuture.get();
if (ft == null || ft.isDone())
return false;
return true;
}
代码示例来源:origin: com.ardor3d/ardor3d-ui
/**
* Check if our tooltip timer is active and cancel it.
*/
protected void cancelTooltipTimer() {
if (_showTask != null && !_showTask.isDone()) {
_showTask.cancel(true);
_showTask = null;
}
}
代码示例来源:origin: com.ardor3d/ardor3d-ui
@Override
public void run() {
if (_showTask != null && !_showTask.isDone()) {
_showTask.run();
}
}
};
代码示例来源:origin: org.apache.cxf/cxf-testutils
protected boolean runClient(Runnable clientImpl, long timeOut, TimeUnit timeUnit)
throws InterruptedException {
FutureTask<?> client = new FutureTask<>(clientImpl, null);
ThreadPoolExecutor tpe = new ThreadPoolExecutor(1, 1, 10000L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
tpe.execute(client);
tpe.shutdown();
tpe.awaitTermination(timeOut, timeUnit);
return client.isDone();
}
}
代码示例来源:origin: uk.org.lidalia/lidalia-lang
@Override
public String toString() {
if (supplier.isDone()) return call().toString();
else return "not yet evaluated";
}
}
代码示例来源:origin: JetBrains/jediterm
static Object info(Runnable info) {
Object task = info;
String extra = null;
if (task instanceof FutureTask) {
extra = ((FutureTask)task).isCancelled() ? " (future cancelled)" : ((FutureTask)task).isDone() ? " (future done)" : null;
task = ObjectUtils.chooseNotNull(ReflectionUtil.getField(task.getClass(), task, Callable.class, "callable"), task);
}
if (task instanceof Callable && task.getClass().getName().equals("java.util.concurrent.Executors$RunnableAdapter")) {
task = ObjectUtils.chooseNotNull(ReflectionUtil.getField(task.getClass(), task, Runnable.class, "task"), task);
}
return extra == null ? task : task == null ? extra : task.getClass() + extra;
}
内容来源于网络,如有侵权,请联系作者删除!