tkalkirill commented on code in PR #1506: URL: https://github.com/apache/ignite-3/pull/1506#discussion_r1072257176
########## modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/PageMemorySortedIndexStorage.java: ########## @@ -298,76 +276,74 @@ public void close() { @Override public boolean hasNext() { - if (!closeBusyLock.enterBusy()) { - throwStorageClosedException(); - } - - try { - advanceIfNeeded(); + return busy(() -> { Review Comment: Same, but why not use a generic template for this class? ########## modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/PageMemorySortedIndexStorage.java: ########## @@ -298,76 +276,74 @@ public void close() { @Override public boolean hasNext() { - if (!closeBusyLock.enterBusy()) { - throwStorageClosedException(); - } - - try { - advanceIfNeeded(); + return busy(() -> { + try { + advanceIfNeeded(); - return hasNext; - } catch (IgniteInternalCheckedException e) { - throw new StorageException("Error while advancing the cursor", e); - } finally { - closeBusyLock.leaveBusy(); - } + return hasNext; + } catch (IgniteInternalCheckedException e) { + throw new StorageException("Error while advancing the cursor", e); + } + }); } @Override public IndexRow next() { - if (!closeBusyLock.enterBusy()) { - throwStorageClosedException(); - } - - try { - advanceIfNeeded(); + return busy(() -> { Review Comment: Same, but why not use a generic template for this class? -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org