ivanzlenko commented on code in PR #4822:
URL: https://github.com/apache/ignite-3/pull/4822#discussion_r1867907906


##########
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteStripedReadWriteLock.java:
##########
@@ -106,7 +106,7 @@ public Lock writeLock() {
      * @return {@code true} if the current thread holds the write lock and 
{@code false} otherwise
      */
     public boolean isWriteLockedByCurrentThread() {
-        return locks[locks.length - 1].isWriteLockedByCurrentThread();
+        return locks[curIdx()].isWriteLockedByCurrentThread();

Review Comment:
   In theory we can place locks[curIdx()] behind additional method. Just to 
prevent any divergences in the future. 



##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -1707,4 +1707,16 @@ private static ReplicationGroupIdMessage 
toReplicationGroupIdMessage(Replication
 
         throw new AssertionError("Not supported: " + replicationGroupId);
     }
+
+    private boolean enterBusy() {
+        return !busyLock.isWriteLockedByCurrentThread() && 
busyLock.readLock().tryLock();
+    }
+
+    private void leaveBusy() {
+        busyLock.readLock().unlock();
+    }
+
+    private void blockBusy() {
+        busyLock.writeLock().lock();
+    }

Review Comment:
   Isn't it better to make this methods to be a part of 
IgniteStripedReadWriteLock?



-- 
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]

Reply via email to