ALX_DM
(ALX DM)
April 10, 2023, 4:01am
1
I read the documents but it is not clear to me.
I have this code:
public void indexProduct(Product product) {
try (BulkIngester<String> bulkIngester = indexingService.createBulkIngester()) {
indexingService.bulkIngestWithAsset(product, bulkIngester);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
for((int i=0; i<10; i++) {
indexProduct(product[i]);
}
Then I will not close.
Is this ok?
RabBit_BR
(andre.coelho)
April 10, 2023, 5:54am
2
Hi @ALX_DM
You should check if the resource implements java.lang.AutoCloseable, if yes the resource will be closed as soon as the try-catch block is executed.
ALX_DM
(ALX DM)
April 11, 2023, 5:17am
3
Hi, the resource does not implement java.lang.AutoCloseable
Is it same as BulkProcessor wherein you have .awaitclose()
And BulkIngester have .close()
only
RabBit_BR
(andre.coelho)
April 11, 2023, 12:11pm
4
In this case, it is better to make the .close explicit.
system
(system)
Closed
May 9, 2023, 12:12pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.