com.linkedin.parseq.Task.cancel()方法的使用及代码示例

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

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

Task.cancel介绍

暂无

代码示例

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

/**
 * {@inheritDoc}
 */
@Override
public boolean cancel(Exception reason) {
 return _task.cancel(reason);
}

代码示例来源:origin: linkedin/parseq

@Override
public boolean cancel(Exception reason) {
 boolean result = _task.cancel(reason);
 //run the task to capture the trace data
 _task.contextRun(this, _parent, _predecessorTasks);
 return result;
}

代码示例来源:origin: linkedin/parseq

@Override
public void uncaughtException(Throwable error) {
 final String msg = "Serial executor loop failed for plan: " + _task.getName();
 final SerialExecutionException ex = new SerialExecutionException(msg, error);
 final boolean wasCancelled = _task.cancel(ex);
 LOG.error(msg + ". The plan was " + (wasCancelled ? "" : "not ") + "cancelled.", ex);
}

代码示例来源:origin: linkedin/parseq

private void runSideEffectSubTask(final Task<?> taskWrapper, final List<Task<?>> predecessors) {
 PlanContext subPlan = _planContext.fork(taskWrapper);
 if (subPlan != null) {
  new ContextImpl(subPlan, taskWrapper, _task, predecessors).runTask();
 } else {
  taskWrapper.cancel(new IllegalStateException("Plan is already completed"));
 }
}

代码示例来源:origin: linkedin/parseq

@Test
public void testCancelAfterCancel() {
 final Task<?> task = TestUtil.noop();
 final Exception reason1 = new Exception();
 final Exception reason2 = new Exception();
 assertTrue(task.cancel(reason1));
 assertFalse(task.cancel(reason2));
 assertCancelled(task, reason1);
}

代码示例来源:origin: linkedin/parseq

@Test
public void testCancelAfterInit() {
 final Task<?> task = TestUtil.noop();
 final Exception reason = new Exception();
 assertTrue(task.cancel(reason));
 assertCancelled(task, reason);
}

代码示例来源:origin: linkedin/parseq

@Test
public void testToTryCancelled() throws InterruptedException {
 Task<String> cancelMain = delayedValue("value", 6000, TimeUnit.MILLISECONDS);
 Task<Try<String>> task = cancelMain.toTry();
 run(task);
 assertTrue(cancelMain.cancel(new Exception("canceled")));
 task.await();
 assertTrue(task.isDone());
 assertTrue(task.isFailed());
 assertTrue(Exceptions.isCancellation(task.getError()));
 logTracingResults("AbstractTaskTest.testToTryCancelled", task);
}

代码示例来源:origin: linkedin/parseq

@Test
public void testCancelAfterDone() throws InterruptedException {
 final String result = "result";
 final Task<String> task = Task.callable("task", () -> result);
 runTask(task);
 assertTrue(task.await(5, TimeUnit.SECONDS));
 assertDone(task, result);
 assertFalse(task.cancel(new Exception()));
 assertDone(task, result);
}

相关文章