Package org.variantsync.boosting.product
Class ProductLoader
java.lang.Object
org.variantsync.boosting.product.ProductLoader
A class that implements an Iterator for loading products using multiple
threads.
This class takes a list of ProductLoadTask objects and a number of threads to
use for loading the products.
It then creates a thread pool with the specified number of threads and
submits tasks to load products.
-
Constructor Summary
ConstructorsConstructorDescriptionProductLoader
(List<ProductLoadTask> loadTasks, int nThreads) Constructs a ProductLoader with the specified list of load tasks and number of threads. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
ProductLoader
Constructs a ProductLoader with the specified list of load tasks and number of threads.- Parameters:
loadTasks
- a list of ProductLoadTask objects representing the tasks to load productsnThreads
- the number of threads to use for loading products
-
-
Method Details
-
hasNext
public boolean hasNext()Checks if there are more products to load. -
next
Loads the next product using a thread from the thread pool.- Specified by:
next
in interfaceIterator<Variant>
- Returns:
- the next product to load
- Throws:
RuntimeException
- if an error occurs while loading the product
-