Skip to content

IGNITE-25680 Refactor DirectBufferCleaner interface #12172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Class extracted for fields from GridUnsafe to be absolutely independent with current and future static block
* initialization effects.
*/
public class FeatureChecker {
class FeatureChecker {
/** Required Options to Run on Java 11. */
public static final String JAVA_11_OPTIONS = "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED\n" +
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public abstract class GridUnsafe {
private static final boolean HAS_JAVA_NIO_ACCESS_MEMORY_SEGMENT_PARAM = majorJavaVersion(jdkVersion()) >= 19;

/** Cleaner code for direct {@code java.nio.ByteBuffer}. */
private static final DirectBufferCleaner DIRECT_BUF_CLEANER = new UnsafeDirectBufferCleaner();
private static final UnsafeDirectBufferCleaner DIRECT_BUF_CLEANER = new UnsafeDirectBufferCleaner();

/** JavaNioAccess object. If {@code null} then {@link #NEW_DIRECT_BUF_CONSTRUCTOR} should be available. */
@Nullable private static final Object JAVA_NIO_ACCESS_OBJ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
import sun.misc.Unsafe;

/**
* {@link DirectBufferCleaner} implementation based on {@code Unsafe.invokeCleaner} method.
*
* Note: This implementation will work only for Java 9+.
* Cleaner for {@code java.nio.ByteBuffer} based on {@code Unsafe.invokeCleaner} method.
*/
public class UnsafeDirectBufferCleaner implements DirectBufferCleaner {
class UnsafeDirectBufferCleaner {
/** Cleaner method. */
private final Method cleanerMtd;

Expand All @@ -40,8 +38,12 @@ public UnsafeDirectBufferCleaner() {
}
}

/** {@inheritDoc} */
@Override public void clean(ByteBuffer buf) {
/**
* Cleans direct buffer.
*
* @param buf direct buffer.
*/
public void clean(ByteBuffer buf) {
GridUnsafe.invoke(cleanerMtd, buf);
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy