ibessonov commented on code in PR #5741: URL: https://github.com/apache/ignite-3/pull/5741#discussion_r2074776988
########## modules/core/src/main/java/org/apache/ignite/internal/util/PointerWrapping.java: ########## @@ -17,19 +17,268 @@ package org.apache.ignite.internal.util; +import static org.apache.ignite.internal.util.GridUnsafe.NATIVE_BYTE_ORDER; +import static org.apache.ignite.internal.util.GridUnsafe.UNSAFE; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; import java.nio.ByteBuffer; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; /** * Wraps a pointer to unmanaged memory into a direct byte buffer. */ -@SuppressWarnings("InterfaceMayBeAnnotatedFunctional") -interface PointerWrapping { +abstract class PointerWrapping { + /** Null object. */ + private static final Object NULL_OBJ = null; + + private static final MethodHandle DIRECT_BUF_MTD; + private static final MethodHandle DIRECT_BUF_CTOR_INT; + private static final MethodHandle DIRECT_BUF_CTOR_LONG; + + private static final Object JAVA_NIO_ACCESS_OBJ; + + static { + Object nioAccessObj = null; + + MethodHandle directBufMtd = null; + MethodHandle directBufCtorWithIntLen = null; + MethodHandle directBufCtorWithLongLen = null; + + try { + directBufCtorWithIntLen = createAndTestNewDirectBufferCtor(int.class); + } catch (Exception e) { + try { + directBufCtorWithLongLen = createAndTestNewDirectBufferCtor(long.class); + } catch (Exception e2) { + try { + nioAccessObj = javaNioAccessObject(); + directBufMtd = newDirectBufferMethodHandle(nioAccessObj); + } catch (Exception exFallback) { + //noinspection CallToPrintStackTrace + exFallback.printStackTrace(); // NOPMD Review Comment: I think we don't -- 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