B
- the bad typepublic class FutureFactory<B> extends Object
Modifier and Type | Field and Description |
---|---|
static FutureFactory<String> |
OF_EXCEPTION_MESSAGE
A default FutureFactory that will execute its tasks with the common
Executors.newCachedThreadPool()
and that will transform any potential exceptions into Strings using Throwable.getMessage() |
Modifier and Type | Method and Description |
---|---|
FutureFactory<One<B>> |
accumulating()
Returns an accumulating version of this factory.
|
<G> OrFuture<G,B> |
newFuture(Executor executor,
Supplier<? extends Or<? extends G,? extends B>> task)
Creates an OrFuture that will execute the given task using the provided executor.
|
<G> OrFuture<G,B> |
newFuture(Supplier<? extends Or<? extends G,? extends B>> task)
Creates an OrFuture that will execute the given task using the executor of this FutureFactory.
|
static <B> FutureFactory<B> |
of(Executor executor,
Function<? super Throwable,? extends B> exceptionConverter)
Creates a new FutureFactory that will create futures that run their tasks using the given
executor and transform unhandled exceptions into instances of Bad using the provided converter.
|
static <B> FutureFactory<B> |
of(Function<? super Throwable,? extends B> exceptionConverter)
Creates a new FutureFactory that will return futures that run their tasks using a common
Executors.newCachedThreadPool() and transform unhandled exceptions
into instances of Bad using the provided converter. |
public static final FutureFactory<String> OF_EXCEPTION_MESSAGE
Executors.newCachedThreadPool()
and that will transform any potential exceptions into Strings using Throwable.getMessage()
public static <B> FutureFactory<B> of(Executor executor, Function<? super Throwable,? extends B> exceptionConverter)
B
- the bad typeexecutor
- the executor to run the tasks withexceptionConverter
- a function to convert exceptions into instances of Badpublic static <B> FutureFactory<B> of(Function<? super Throwable,? extends B> exceptionConverter)
Executors.newCachedThreadPool()
and transform unhandled exceptions
into instances of Bad using the provided converter.B
- the bad typeexceptionConverter
- a function to convert exceptions into instances of Badpublic <G> OrFuture<G,B> newFuture(Supplier<? extends Or<? extends G,? extends B>> task)
G
- the good typetask
- asynchronous computation to executepublic <G> OrFuture<G,B> newFuture(Executor executor, Supplier<? extends Or<? extends G,? extends B>> task)
G
- the good typeexecutor
- the executor to run the asynchronous computation ontask
- asynchronous computation to executepublic FutureFactory<One<B>> accumulating()
Copyright © 2016. All rights reserved.