rpuch commented on a change in pull request #566:
URL: https://github.com/apache/ignite-3/pull/566#discussion_r789621908



##########
File path: 
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/util/PageLockListener.java
##########
@@ -0,0 +1,85 @@
+/*
+ * 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.util;
+
+/**
+ * Page lock listener.
+ */
+public interface PageLockListener extends AutoCloseable {
+    /**
+     * Callback that's called before write lock acquiring.
+     *
+     * @param groupId Group ID.
+     * @param pageId  Page ID.
+     * @param page    Page pointer.
+     */
+    public void onBeforeWriteLock(int groupId, long pageId, long page);
+
+    /**
+     * Callback that's called before after lock acquiring.
+     *
+     * @param groupId  Group ID.
+     * @param pageId   Page ID.
+     * @param page     Page pointer.
+     * @param pageAddr Page address.
+     */
+    public void onWriteLock(int groupId, long pageId, long page, long 
pageAddr);
+
+    /**
+     * Callback that's called before write lock releasing.
+     *
+     * @param groupId  Group ID.
+     * @param pageId   Page ID.
+     * @param page     Page pointer.
+     * @param pageAddr Page address.
+     */
+    public void onWriteUnlock(int groupId, long pageId, long page, long 
pageAddr);
+
+    /**
+     * Callback that's called before read lock acquiring.
+     *
+     * @param groupId Group ID.
+     * @param pageId  Page ID.
+     * @param page    Page pointer.
+     */
+    public void onBeforeReadLock(int groupId, long pageId, long page);
+
+    /**
+     * Callback that's called after read lock acquiring.
+     *
+     * @param groupId  Group ID.
+     * @param pageId   Page ID.
+     * @param page     Page pointer.
+     * @param pageAddr Page address.
+     */
+    public void onReadLock(int groupId, long pageId, long page, long pageAddr);
+
+    /**
+     * Callback that's called before read lock releasing.

Review comment:
       There is some inconsistency here. For locking methods, the methods are 
`onBeforeXXXLock()` (called before) and `onXXXLock()` (called after). But for 
unlocking methods, `onXXXUnlock()` is called **before** the actual unlocking.
   
   It might have some logic behind it, but it still can cause confusion.
   
   Could we always write `Before`/`After` in the method names? Like 
`onBeforeWriteLock()`, `onAfterWriteLock()`, `onBeforeWriteUnlock()` to avoid 
such confusion?

##########
File path: 
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/util/PageLockListener.java
##########
@@ -0,0 +1,85 @@
+/*
+ * 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.util;
+
+/**
+ * Page lock listener.
+ */
+public interface PageLockListener extends AutoCloseable {
+    /**
+     * Callback that's called before write lock acquiring.
+     *
+     * @param groupId Group ID.
+     * @param pageId  Page ID.
+     * @param page    Page pointer.
+     */
+    public void onBeforeWriteLock(int groupId, long pageId, long page);
+
+    /**
+     * Callback that's called before after lock acquiring.

Review comment:
       ```suggestion
        * Callback that's called after lock acquiring.
   ```




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