CleanerJava24Linker.java — netty Source File
Architecture documentation for CleanerJava24Linker.java, a java file in the netty codebase.
Entity Profile
Relationship Graph
Source Code
/*
* Copyright 2025 The Netty Project
*
* The Netty Project 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:
*
* https://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 io.netty.util.internal;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import static java.lang.invoke.MethodType.methodType;
public class CleanerJava24Linker implements Cleaner {
private static final InternalLogger logger;
private static final MethodHandle INVOKE_MALLOC;
private static final MethodHandle INVOKE_CREATE_BYTEBUFFER;
private static final MethodHandle INVOKE_FREE;
static {
boolean suitableJavaVersion;
if (System.getProperty("org.graalvm.nativeimage.imagecode") != null) {
// native image supports this since 25, but we don't use PlatformDependent0 here, since
// we need to initialize CleanerJava24Linker at build time.
String v = System.getProperty("java.specification.version");
try {
suitableJavaVersion = Integer.parseInt(v) >= 25;
} catch (NumberFormatException e) {
suitableJavaVersion = false;
}
// also need to prevent initializing the logger at build time
logger = null;
} else {
// Only attempt to use MemorySegments on Java 24 or greater, where warnings about Unsafe
// memory access operations start to appear.
// The following JDK bugs do NOT affect our implementation because the memory segments we
// create are associated with the GLOBAL_SESSION:
// - https://bugs.openjdk.org/browse/JDK-8357145
// - https://bugs.openjdk.org/browse/JDK-8357268
suitableJavaVersion = PlatformDependent0.javaVersion() >= 24;
logger = InternalLoggerFactory.getInstance(CleanerJava24Linker.class);
}
MethodHandle mallocMethod;
MethodHandle wrapMethod;
// ... (210 more lines)
Domain
Subdomains
Source
Frequently Asked Questions
What does CleanerJava24Linker.java do?
CleanerJava24Linker.java is a source file in the netty codebase, written in java. It belongs to the CommonUtil domain, Internal subdomain.
Where is CleanerJava24Linker.java in the architecture?
CleanerJava24Linker.java is located at common/src/main/java/io/netty/util/internal/CleanerJava24Linker.java (domain: CommonUtil, subdomain: Internal, directory: common/src/main/java/io/netty/util/internal).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free