Probably the best Java library for execute sync / async task
<repository>
<id>hotire</id>
<url>http://dl.bintray.com/hotire/utils</url>
</repository>
<dependency>
<groupId>com.github.hotire</groupId>
<artifactId>executor-core</artifactId>
<version>1.1.3</version>
</dependency>
- Supplier
DefaultAsyncExecutor
.ofTask(executor, testService::service)
.addTask(testService::get, testService::rollback, testService::save)
.execute();
DefaultAsyncExecutor
.ofTask(executor, testService::service)
.addTask(testService::get, testService::rollback, testService::save)
.executeByAsync();
- Supplier
DefaultExecutor
.ofTask(testService::service)
.addTask(testService::get)
.execute();
DefaultExecutor
.ofTask(testService::service)
.addTask(() -> { throw new RuntimeException();})
.addTask(testService::get)
.execute();
- Function
DefaultExecutor
.ofFunctionTask(() -> "s")
.addTask(s -> s + s)
.addTask(s -> s + s)
.execute()
.stream()
.map(ExecutorResponse::getBody)
.forEach(System.out::println);
output
s
ss
ssss