rpuch commented on code in PR #1291:
URL: https://github.com/apache/ignite-3/pull/1291#discussion_r1012539301
##########
modules/transactions/src/test/java/org/apache/ignite/internal/tx/storage/state/TxStateStorageAbstractTest.java:
##########
@@ -150,10 +167,14 @@ public void testCas() throws Exception {
@Test
public void testScan() throws Exception {
- try (TxStateTableStorage tableStorage = createStorage()) {
- TxStateStorage storage0 =
tableStorage.getOrCreateTxStateStorage(0);
- TxStateStorage storage1 =
tableStorage.getOrCreateTxStateStorage(1);
- TxStateStorage storage2 =
tableStorage.getOrCreateTxStateStorage(2);
+ try (
+ var storageHolder0 = new
AutoCloser<>(tableStorage.getOrCreateTxStateStorage(0), TxStateStorage::close);
Review Comment:
`try-with-resources` provides some safeness guarantees, you cannot forget to
close a resource used with `try-with-resources`, but you can if you don't use
this idiom.
On the other hand, in tests it's not that critical to leak a resource, so I
removed `try-with-resources` altogether.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]