kactoos-jvm / nnl.rocks.kactoos.func / Async / <init>
Async(proc:
Proc
<
X
>, result:
Y
, fct:
ThreadFactory
)
proc
- The proc
fct
- FactoryAsync(fnc:
Func
<
X
,
Y
>, fct:
ThreadFactory
)
fnc
- The func
fct
- FactoryAsync(fnc:
Func
<
X
,
Y
>)
Async(func:
Func
<
X
,
Y
>, executor:
ExecutorService
)
Func that runs in the background.
If you want your piece of code to be executed in the background, use Async as following:
int length = new Async(
input -> input.length()
).invoke("Hello, world!").get();
There is no thread-safety guarantee.
X
- Type of input
Y
- Type of output
func
- The func
executor
- Executor Service
Since 0.10