ibessonov commented on code in PR #5065:
URL: https://github.com/apache/ignite-3/pull/5065#discussion_r1921864816


##########
modules/page-memory/src/integrationTest/java/org/apache/ignite/internal/pagememory/tree/util/SequencedOffheapReadWriteLock.java:
##########
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.pagememory.tree.util;
+
+import it.unimi.dsi.fastutil.longs.LongArrayList;
+import it.unimi.dsi.fastutil.longs.LongList;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.IntSupplier;
+import java.util.function.LongPredicate;
+import org.apache.ignite.internal.util.OffheapReadWriteLock;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Off-heap read-write lock that allows to sequence the lock acquisition order 
if necessary.
+ */
+public class SequencedOffheapReadWriteLock extends OffheapReadWriteLock {
+    /** Number of threads that are actively waiting on {@link 
Sequencer#await()} or {@link Sequencer#complete()} right now. */
+    private final AtomicInteger activelyWaiting = new AtomicInteger();
+
+    /** {@link Sequencer} instance that will be used to order the locks. Might 
be {@code null}. */
+    private volatile @Nullable Sequencer sequencer;
+
+    /** All the locks acquired by all the threads. Used for a deadlock 
prevention. */
+    private volatile LongList @Nullable [] acquiredLocks;
+
+    /**
+     * Constructor.
+     */
+    public SequencedOffheapReadWriteLock() {
+        super(128);

Review Comment:
   Not in this PR :)



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