本文整理了Java中com.linkedin.parseq.Task.flatten()
方法的一些代码示例,展示了Task.flatten()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.flatten()
方法的具体详情如下:
包路径:com.linkedin.parseq.Task
类名称:Task
方法名:flatten
[英]Equivalent to flatten("flatten", task).
[中]相当于展平(“展平”,任务)。
代码示例来源:origin: linkedin/parseq
/**
* Equivalent to {@code flatten("flatten", task)}.
* @see #flatten(String, Task)
*/
public static <R> Task<R> flatten(final Task<Task<R>> task) {
return flatten("flatten", task);
}
代码示例来源:origin: linkedin/parseq
@Test
public void testFlattenFailure() {
Task<Task<String>> nested = Task.callable(() -> getFailureTask());
Task<String> flat = Task.flatten(nested);
try {
runAndWait("AbstractTaskTest.testFlattenFailure", flat);
fail("should have failed");
} catch (Exception ex) {
assertTrue(flat.isFailed());
}
assertEquals(flat.getError().getMessage(), TASK_ERROR_MESSAGE);
}
代码示例来源:origin: linkedin/parseq
public void testFlattenTaskReturnNulll() {
Function1<String, Task<String>> func = s -> null;
Task<String> task = Task.flatten(getSuccessTask().map(func));
runAndWaitException("AbstractTaskTest.testFlattenTaskReturnNulll", task, RuntimeException.class);
assertTrue(task.getError().getMessage().contains("returned null"));
}
代码示例来源:origin: linkedin/parseq
@Test
public void testFlatten() {
Task<Task<String>> nested = Task.callable(() -> getSuccessTask());
Task<String> flat = Task.flatten(nested);
runAndWait("AbstractTaskTest.testFlatten", flat);
assertEquals(flat.get(), TASK_VALUE);
}
代码示例来源:origin: linkedin/parseq
final Task<Task<R>> nested = map(desc, flatMapFunc);
nested.getShallowTraceBuilder().setSystemHidden(true);
return flatten(desc, nested);
代码示例来源:origin: com.linkedin.parseq/parseq
/**
* Equivalent to {@code flatten("flatten", task)}.
* @see #flatten(String, Task)
*/
public static <R> Task<R> flatten(final Task<Task<R>> task) {
return flatten("flatten", task);
}
代码示例来源:origin: com.linkedin.parseq/parseq-tracevis-server
private Task<HttpResponse> fetchJSON(HttpServletRequest request) {
String location = request.getParameter("location");
if (location == null) {
return Task.value(new HttpResponse(HttpServletResponse.SC_BAD_REQUEST, "Missing location query parameter"));
} else {
return Task.flatten(Task.callable(() -> oqlGetTask(location)))
.map("processOQLResponse", this::processOQLResponse);
}
}
代码示例来源:origin: com.linkedin.parseq/parseq
final Task<Task<R>> nested = map(desc, flatMapFunc);
nested.getShallowTraceBuilder().setSystemHidden(true);
return flatten(desc, nested);
内容来源于网络,如有侵权,请联系作者删除!