Answer the question
In order to leave comments, you need to log in
Why are elements added to the ArrayList happening in batches of 10 elements?
There is a task - to parse a bunch of objects, a little more than 200k and add them to the sheet. Here is the log of adding elements
[2021-10-04 10:58:05,213]-[export-1] INFO - new object process: 32060
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32061
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32062
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32063
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32064
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32065
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32066
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32067
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32068
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32069
[2021-10-04 10:58:05,418]-[export-1] INFO - new object process: 32070
[2021-10-04 10:58:05,622]-[export-1] INFO - new object process: 32071
List<exportObject> objects = new ArrayList<>(200000);
int i = 0;
while (resultSet.next()) {
log.info("new object process: {}", ++i);
Integer lvl = resultSet.getInt("lvl");
String objectId = resultSet.getString("object_id");
int orderNumber = resultSet.getInt("order_number");
objects.add(new exportObject(lvl, objectId, orderNumber));
}
Answer the question
In order to leave comments, you need to log in
Maybe the database driver immediately pulls the next 10 objects from the ResultSet, if any. When they end, the driver goes back to the database for new data
. Something like this https://docs.oracle.com/cd/E11882_01/java.112/e165...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question