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

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

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

Task.await介绍

暂无

代码示例

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

/**
 * {@inheritDoc}
 */
@Override
public boolean await(long time, TimeUnit unit) throws InterruptedException {
 return _task.await(time, unit);
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean await(long time, TimeUnit unit) throws InterruptedException {
 return _task.await(time, unit);
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean await(long time, TimeUnit unit) throws InterruptedException {
 return _task.await(time, unit);
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean await(long time, TimeUnit unit) throws InterruptedException {
 return _task.await(time, unit);
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean await(long time, TimeUnit unit) throws InterruptedException {
 return _task.await(time, unit);
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean await(long time, TimeUnit unit) throws InterruptedException {
 return _task.await(time, unit);
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

/**
 * {@inheritDoc}
 */
@Override
public void await() throws InterruptedException {
 _task.await();
}

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

@Override
 public void run() {
  engine.run(task);
  try {
   assertTrue(task.await(5, TimeUnit.SECONDS));
  } catch (InterruptedException e) {
   // Ignore.
  }
 }
});

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

@Test
public void testRunWithSyncError() throws InterruptedException {
 final Exception exception = new Exception();
 final Task<String> task = Task.callable("task", () -> {
  throw exception;
 } );
 runTask(task);
 assertTrue(task.await(5, TimeUnit.SECONDS));
 assertFailed(task, exception);
}

代码示例来源: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 testWithSideEffectFullCompletion(int expectedNumberOfTasks) throws Exception {
 Task<String> fastMain = getSuccessTask();
 Task<String> slowSideEffect = delayedValue("slow", 50, TimeUnit.MILLISECONDS);
 Task<String> full = fastMain.withSideEffect(s -> slowSideEffect);
 // ensure the side effect task will be run
 runAndWait("AbstractTaskTest.testWithSideEffectFullCompletion", full);
 slowSideEffect.await();
 assertTrue(full.isDone());
 assertTrue(fastMain.isDone());
 assertTrue(slowSideEffect.isDone());
 assertEquals(countTasks(full.getTrace()), expectedNumberOfTasks);
}

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

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

@Test
public void testShutdownThenRunTask() throws InterruptedException {
 _engine.shutdown();
 final Task<String> task = Task.value("task executed");
 _engine.run(task);
 // Task should be cancelled immediately
 assertTrue(task.await(50, TimeUnit.MILLISECONDS));
 assertTrue(task.isFailed());
}

相关文章