Package org.apache.fluo.api.client
Interface LoaderExecutor
-
- All Superinterfaces:
AutoCloseable
public interface LoaderExecutor extends AutoCloseable
- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Waits for all queued and running Loader task to complete, then cleans up resources.void
execute(String identity, Loader loader)
Same asexecute(Loader)
, but allows specifying an identity.void
execute(Loader loader)
QueuesLoader
task implemented by users for execution.<T extends Loader>
CompletableFuture<T>submit(String identity, T loader)
Same behavior assubmit(Loader)
.<T extends Loader>
CompletableFuture<T>submit(T loader)
Same asexecute(Loader)
except it returns a future that completes upon successful commit and if an exception is thrown in the loader, it will be relayed through the future.
-
-
-
Method Detail
-
execute
void execute(Loader loader)
QueuesLoader
task implemented by users for execution. The load Task may not have completed when the method returns. If the queue is full, this method will block.If a previous execution of loader has thrown an exception, then this call may throw an exception. To avoid this odd behavior use
submit(Loader)
instead which relays exceptions through the returned future.
-
execute
void execute(String identity, Loader loader)
Same asexecute(Loader)
, but allows specifying an identity. The identity is used in metrics and trace logging. When an identity is not supplied, the class name is used. In the case of lambdas the class name may not be the same in different processes.- Since:
- 1.1.0
-
submit
<T extends Loader> CompletableFuture<T> submit(T loader)
Same asexecute(Loader)
except it returns a future that completes upon successful commit and if an exception is thrown in the loader, it will be relayed through the future. The result of the future is the Loader that was successfully executed. If storing any information in the loader object, keep in mind that loaders may execute multiple times in the case of commit collisions. If a loader executes multiple times, it may see different data on subsequent executions.- Since:
- 2.0.0
-
submit
<T extends Loader> CompletableFuture<T> submit(String identity, T loader)
Same behavior assubmit(Loader)
.- Parameters:
identity
- seeexecute(String, Loader)
for a description of this parameter- Since:
- 2.0.0
-
close
void close()
Waits for all queued and running Loader task to complete, then cleans up resources.If a loader executed via
execute(Loader)
orexecute(String, Loader)
threw an exception then this method will throw an exception. Exceptions thrown by loaders executed usingsubmit(Loader)
orsubmit(String, Loader)
will never cause this method to throw an exception.- Specified by:
close
in interfaceAutoCloseable
-
-