Skip to content

hotire/executor-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Executor Core

delivery

Probably the best Java library for execute sync / async task

Installation

Maven

<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>

How to use

Async

  • 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();

Sync

  • 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

blog

Core (Task, AbstractSupplierExecutor, AbstractFunctionExecutor)

DefaultExecutor (SupplierExecutor, FunctionExecutor), DefaultAsyncExecutor

Getting Started Executor Core

About

๐Ÿš› execute sync / async task

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages