Tour page 18 of 28
Fluo provides a simple mechanism to help load data called the LoaderExecutor. Loading data into Fluo requires a transaction. The LoaderExecutor manages creating, committing, and retrying transactions when collisions occur. It also runs transactions in multiple threads and batches commit processing of separate transactions for efficiency. FluoConfiguration provides two methods for configuring LoaderExecutors setLoaderQueueSize() and setLoaderThreads().
Objects that implement Loader are given to a LoaderExecutor. The load() method will
eventually be called on these objects at which point the passed in transactions can be used to load
data. When close()
is called on a LoaderExecutor, it waits for all running and queued work to
finish.
There is no stand alone exercise for the LoaderExecutor. Hands on experience with it can be obtained by completing the word count exercise that is a few pages later in the tour.