Interface PojoMassEntityLoader<I>
- Type Parameters:
I
- The type of entity identifiers.
- All Superinterfaces:
AutoCloseable
A loader for mass loading of entities, used in particular during mass indexing.
Compared to PojoSelectionEntityLoader
, this loader:
- Receives batches of identifiers from a
PojoMassIdentifierLoader
- Is expected to load a very large number of entities in multiple small batches.
- Pushes loaded entities to a sink.
- Sets up its own context (session, transactions, ...), instead of potentially relying on a pre-existing context.
- Is free to discard the entities after the sink is done processing them.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes thisPojoMassEntityLoader
.void
Loads the entities corresponding to the given identifiers and adds them to the given sink, blocking the current thread while doing so.
-
Method Details
-
close
void close()Closes thisPojoMassEntityLoader
.- Specified by:
close
in interfaceAutoCloseable
-
load
Loads the entities corresponding to the given identifiers and adds them to the given sink, blocking the current thread while doing so.Calls to the sink must be performed synchronously (before this method returns).
Entities must be passed to the sink using a single call to
PojoMassEntitySink.accept(List)
.Entities passed to the sink do not need to be the same order as
identifiers
.- Parameters:
identifiers
- A list of identifiers of entities to load.- Throws:
InterruptedException
- If the thread was interrupted while performing I/O operations. This will lead to aborting mass indexing completely.
-