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

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

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

Task.getError介绍

暂无

代码示例

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

/**
 * {@inheritDoc}
 */
@Override
public Throwable getError() throws PromiseUnresolvedException {
 return _task.getError();
}

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

@Override
 protected void doRunExample(final Engine engine) throws Exception {
  final MockService<String> httpClient = getService();

  final Task<Integer> fetchAndLength =
    fetch404Url(httpClient, "http://www.google.com")
     .map("length", x -> x.length());

  engine.run(fetchAndLength);

  fetchAndLength.await();

  System.out.println("Error while fetching url: " + fetchAndLength.getError());

  ExampleUtil.printTracingResults(fetchAndLength);
 }
}

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

public void testFlatMapFuncReturnNulll() {
 Task<String> task = getSuccessTask().flatMap(str -> null);
 runAndWaitException("AbstractTaskTest.testFlatMapFuncReturnNulll", task, RuntimeException.class);
 assertTrue(task.getError().getMessage().contains("returned null"));
}

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

public void testWithSideEffectFuncReturnNulll() {
 Task<String> task = getSuccessTask().withSideEffect(str -> null);
 runAndWaitException("AbstractTaskTest.testWithSideEffectFuncReturnNulll", task, RuntimeException.class);
 assertTrue(task.getError().getMessage().contains("returned null"));
}

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

public void testRecoverWithFuncReturnNulll() {
 Task<String> task = getFailureTask().recoverWith(e -> null);
 runAndWaitException("AbstractTaskTest.testRecoverWithFuncReturnNulll", task, RuntimeException.class);
 assertTrue(task.getError().getMessage().contains("returned null"));
}

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

@Test
public void testFailure() {
 Exception e = new Exception("ups!");
 Task<Integer> task = Task.failure(e);
 try {
  runAndWait("TestTaskFactoryMethods.testFailure", task);
  fail("should have failed");
 } catch (Exception ex) {
  assertEquals(task.getError(), e);
 }
 assertEquals(countTasks(task.getTrace()), 1);
}

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

@Test
public void testTransformFailureToSuccess() {
 Task<String> failure = getFailureTask();
 Task<String> transformed = failure.transform(tryT -> Success.of(tryT.getError().toString() + "transformed"));
 runAndWait("AbstractTaskTest.testTransformFailureToSuccess", transformed);
 assertEquals(transformed.get(), failure.getError().toString() + "transformed");
}

代码示例来源: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

public void testCancelledRecover(int expectedNumberOfTasks) {
 Task<Integer> cancelled = getCancelledTask().map("strlen", String::length).recover(e -> -1);
 try {
  runAndWait("AbstractTaskTest.testCancelledRecover", cancelled);
  fail("should have failed");
 } catch (Exception ex) {
  assertTrue(cancelled.isFailed());
  assertTrue(Exceptions.isCancellation(cancelled.getError()));
 }
 assertEquals(countTasks(cancelled.getTrace()), expectedNumberOfTasks);
}

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

private <T> void assertDone(final Task<T> task, final T expectedValue) {
 assertTrue(task.isDone());
 assertFalse(task.isFailed());
 assertEquals(expectedValue, task.get());
 assertNull(task.getError());
 assertTrue(task.getShallowTrace().getStartNanos() > 0);
 assertTrue(task.getShallowTrace().getStartNanos() <= task.getShallowTrace().getEndNanos());
}

相关文章