azagrebin commented on a change in pull request #11160: [FLINK-15094] Use 
Unsafe to instantiate and construct DirectByteBuffer
URL: https://github.com/apache/flink/pull/11160#discussion_r383744901
 
 

 ##########
 File path: 
flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
 ##########
 @@ -60,32 +63,31 @@
                }
        }
 
-       /** Should not be instantiated. */
-       private MemoryUtils() {}
-
-       private static Constructor<? extends ByteBuffer> 
getDirectBufferPrivateConstructor() {
+       private static long 
getClassFieldOffset(@SuppressWarnings("SameParameterValue") Class<?> cl, String 
fieldName) {
+               final String errorMessage = "Could not get field '" + fieldName 
+ "' offset in class '" + cl + "' for unsafe operations";
 
 Review comment:
   This for readability to have it once, otherwise it cannot be shared by 
separate catch block scopes.
   I would hope that JVM will execute it only in case of error anyways.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to