This is an automated email from the ASF dual-hosted git repository.

nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new fb76e9cdd32 IGNITE-25197 Move GridUnsafe to ignite-unsafe (#12017)
fb76e9cdd32 is described below

commit fb76e9cdd324a8f43009451a5bc81b0806047d53
Author: Maksim Davydov <[email protected]>
AuthorDate: Tue Jun 17 22:11:24 2025 +0300

    IGNITE-25197 Move GridUnsafe to ignite-unsafe (#12017)
---
 assembly/dependencies-apache-ignite-lgpl.xml       |  1 +
 modules/bom/pom.xml                                |  5 ++
 modules/calcite/pom.xml                            |  6 ++
 .../ignite/IgniteCommonsSystemProperties.java      | 21 +++++++
 .../apache/ignite/internal/util/CommonUtils.java   | 68 ++++++++++++++++++++++
 modules/compress/pom.xml                           |  6 ++
 modules/control-utility/pom.xml                    |  6 ++
 modules/core/pom.xml                               | 13 +++++
 .../org/apache/ignite/IgniteSystemProperties.java  | 21 -------
 .../apache/ignite/internal/util/IgniteUtils.java   | 63 --------------------
 modules/dev-utils/pom.xml                          |  6 ++
 modules/direct-io/pom.xml                          |  6 ++
 modules/indexing/pom.xml                           |  6 ++
 modules/unsafe/pom.xml                             | 63 ++++++++++++++++++++
 .../ignite/internal/util/DirectBufferCleaner.java  |  0
 .../ignite/internal/util/FeatureChecker.java       |  0
 .../apache/ignite/internal/util/GridUnsafe.java    | 21 ++++---
 .../internal/util/UnsafeDirectBufferCleaner.java   |  0
 pom.xml                                            |  1 +
 19 files changed, 218 insertions(+), 95 deletions(-)

diff --git a/assembly/dependencies-apache-ignite-lgpl.xml 
b/assembly/dependencies-apache-ignite-lgpl.xml
index 569f71b7600..e976b6593e9 100644
--- a/assembly/dependencies-apache-ignite-lgpl.xml
+++ b/assembly/dependencies-apache-ignite-lgpl.xml
@@ -137,6 +137,7 @@
                 <exclude>${project.groupId}:ignite-sqlline</exclude>
                 <exclude>${project.groupId}:ignite-control-utility</exclude>
                 <exclude>${project.groupId}:ignite-checkstyle</exclude>
+                <exclude>${project.groupId}:ignite-grid-unsafe</exclude>
             </excludes>
             <sources>
                 <includeModuleDirectory>true</includeModuleDirectory>
diff --git a/modules/bom/pom.xml b/modules/bom/pom.xml
index bdd0c3a9063..20c5fd168fa 100644
--- a/modules/bom/pom.xml
+++ b/modules/bom/pom.xml
@@ -81,6 +81,11 @@
                 <artifactId>ignite-indexing</artifactId>
                 <version>${revision}</version>
             </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>ignite-grid-unsafe</artifactId>
+                <version>${revision}</version>
+            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>ignite-jta</artifactId>
diff --git a/modules/calcite/pom.xml b/modules/calcite/pom.xml
index 8f044cfb725..30ce5c8b5fd 100644
--- a/modules/calcite/pom.xml
+++ b/modules/calcite/pom.xml
@@ -69,6 +69,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-grid-unsafe</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <!--
             Indexing is required for cross-engines tests.
         -->
diff --git 
a/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java
 
b/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java
index a1fca734d57..08db4e746c0 100644
--- 
a/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java
+++ 
b/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java
@@ -19,6 +19,7 @@ package org.apache.ignite;
 
 import org.jetbrains.annotations.Nullable;
 
+import static 
org.apache.ignite.internal.util.CommonUtils.DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD;
 import static 
org.apache.ignite.internal.util.tostring.GridToStringBuilder.DFLT_TO_STRING_COLLECTION_LIMIT;
 import static 
org.apache.ignite.internal.util.tostring.GridToStringBuilder.DFLT_TO_STRING_INCLUDE_SENSITIVE;
 import static 
org.apache.ignite.internal.util.tostring.GridToStringBuilder.DFLT_TO_STRING_MAX_LENGTH;
@@ -47,6 +48,26 @@ public class IgniteCommonsSystemProperties {
         type = Integer.class, defaults = "" + DFLT_TO_STRING_COLLECTION_LIMIT)
     public static final String IGNITE_TO_STRING_COLLECTION_LIMIT = 
"IGNITE_TO_STRING_COLLECTION_LIMIT";
 
+    /**
+     * When unsafe memory copy if performed below this threshold, Ignite will 
do it on per-byte basis instead of
+     * calling to Unsafe.copyMemory().
+     * <p>
+     * Defaults to 0, meaning that threshold is disabled.
+     */
+    @SystemProperty(value = "When unsafe memory copy if performed below this 
threshold, Ignite will do it " +
+        "on per-byte basis instead of calling to Unsafe.copyMemory(). 0 
disables threshold",
+        type = Long.class, defaults = "" + DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD)
+    public static final String IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD = 
"IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD";
+
+    /**
+     * Whether Ignite can access unaligned memory addresses.
+     * <p>
+     * Defaults to {@code false}, meaning that unaligned access will be 
performed only on x86 architecture.
+     */
+    @SystemProperty("Whether Ignite can access unaligned memory addresses. 
Defaults to false, " +
+        "meaning that unaligned access will be performed only on x86 
architecture")
+    public static final String IGNITE_MEMORY_UNALIGNED_ACCESS = 
"IGNITE_MEMORY_UNALIGNED_ACCESS";
+
     /**
      * @param enumCls Enum type.
      * @param name Name of the system property or environment variable.
diff --git 
a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java
 
b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java
index a7cc2bf37fb..e491a0f4e82 100644
--- 
a/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java
+++ 
b/modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java
@@ -21,6 +21,8 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteCommonsSystemProperties;
+import org.apache.ignite.internal.util.typedef.F;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -36,6 +38,9 @@ public abstract class CommonUtils {
      */
     public static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
 
+    /** @see 
IgniteCommonsSystemProperties#IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD */
+    public static final long DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD = 0L;
+
     /** Sun-specific JDK constructor factory for objects that don't have empty 
constructor. */
     private static final Method CTOR_FACTORY;
 
@@ -48,6 +53,9 @@ public abstract class CommonUtils {
     /** System line separator. */
     static final String NL = System.getProperty("line.separator");
 
+    /** Version of the JDK. */
+    static String jdkVer;
+
     static {
         try {
             OBJECT_CTOR = Object.class.getConstructor();
@@ -74,6 +82,8 @@ public abstract class CommonUtils {
 
         CTOR_FACTORY = ctorFac;
         SUN_REFLECT_FACTORY = refFac;
+
+        CommonUtils.jdkVer = System.getProperty("java.specification.version");
     }
 
     /**
@@ -176,4 +186,62 @@ public abstract class CommonUtils {
     public static String nl() {
         return NL;
     }
+
+    /**
+     * Gets JDK version.
+     *
+     * @return JDK version.
+     */
+    public static String jdkVersion() {
+        return jdkVer;
+    }
+
+    /**
+     * Get major Java version from string.
+     *
+     * @param verStr Version string.
+     * @return Major version or zero if failed to resolve.
+     */
+    public static int majorJavaVersion(String verStr) {
+        if (F.isEmpty(verStr))
+            return 0;
+
+        try {
+            String[] parts = verStr.split("\\.");
+
+            int major = Integer.parseInt(parts[0]);
+
+            if (parts.length == 1)
+                return major;
+
+            int minor = Integer.parseInt(parts[1]);
+
+            return major == 1 ? minor : major;
+        }
+        catch (Exception e) {
+            return 0;
+        }
+    }
+
+    /**
+     * @param x X.
+     * @param less Less.
+     */
+    public static int nearestPow2(int x, boolean less) {
+        assert x > 0 : "can not calculate for less zero";
+
+        long y = 1;
+
+        while (y < x) {
+            if (y * 2 > Integer.MAX_VALUE)
+                return (int)y;
+
+            y *= 2;
+        }
+
+        if (less)
+            y /= 2;
+
+        return (int)y;
+    }
 }
diff --git a/modules/compress/pom.xml b/modules/compress/pom.xml
index 66d1fc3c58d..b8560b02cbb 100644
--- a/modules/compress/pom.xml
+++ b/modules/compress/pom.xml
@@ -53,6 +53,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-grid-unsafe</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>ignite-indexing</artifactId>
diff --git a/modules/control-utility/pom.xml b/modules/control-utility/pom.xml
index 574d9f8332e..dcd7e9764ab 100644
--- a/modules/control-utility/pom.xml
+++ b/modules/control-utility/pom.xml
@@ -53,6 +53,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-grid-unsafe</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>ignite-spring</artifactId>
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index d1daf296c6d..e144914610c 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -67,6 +67,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-grid-unsafe</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>mx4j</groupId>
             <artifactId>mx4j-tools</artifactId>
@@ -233,6 +239,13 @@
                     <include>**/*</include>
                 </includes>
             </resource>
+
+            <resource>
+                <directory>../unsafe/target/classes</directory>
+                <includes>
+                    <include>**/*</include>
+                </includes>
+            </resource>
         </resources>
 
         <testResources>
diff --git 
a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java 
b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index f0430f0178d..35b0d06165f 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -139,7 +139,6 @@ import static 
org.apache.ignite.internal.processors.rest.GridRestProcessor.DFLT_
 import static 
org.apache.ignite.internal.processors.rest.handlers.task.GridTaskCommandHandler.DFLT_MAX_TASK_RESULTS;
 import static 
org.apache.ignite.internal.util.GridLogThrottle.DFLT_LOG_THROTTLE_CAPACITY;
 import static 
org.apache.ignite.internal.util.GridReflectionCache.DFLT_REFLECTION_CACHE_SIZE;
-import static 
org.apache.ignite.internal.util.GridUnsafe.DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD;
 import static 
org.apache.ignite.internal.util.IgniteExceptionRegistry.DEFAULT_QUEUE_SIZE;
 import static 
org.apache.ignite.internal.util.IgniteUtils.DFLT_MBEAN_APPEND_CLASS_LOADER_ID;
 import static 
org.apache.ignite.internal.util.StripedExecutor.DFLT_DATA_STREAMING_EXECUTOR_SERVICE_TASKS_STEALING_THRESHOLD;
@@ -1000,26 +999,6 @@ public final class IgniteSystemProperties extends 
IgniteCommonsSystemProperties
         "By default, the natural order is used")
     public static final String IGNITE_BINARY_SORT_OBJECT_FIELDS = 
"IGNITE_BINARY_SORT_OBJECT_FIELDS";
 
-    /**
-     * Whether Ignite can access unaligned memory addresses.
-     * <p>
-     * Defaults to {@code false}, meaning that unaligned access will be 
performed only on x86 architecture.
-     */
-    @SystemProperty("Whether Ignite can access unaligned memory addresses. 
Defaults to false, " +
-        "meaning that unaligned access will be performed only on x86 
architecture")
-    public static final String IGNITE_MEMORY_UNALIGNED_ACCESS = 
"IGNITE_MEMORY_UNALIGNED_ACCESS";
-
-    /**
-     * When unsafe memory copy if performed below this threshold, Ignite will 
do it on per-byte basis instead of
-     * calling to Unsafe.copyMemory().
-     * <p>
-     * Defaults to 0, meaning that threshold is disabled.
-     */
-    @SystemProperty(value = "When unsafe memory copy if performed below this 
threshold, Ignite will do it " +
-        "on per-byte basis instead of calling to Unsafe.copyMemory(). 0 
disables threshold",
-        type = Long.class, defaults = "" + DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD)
-    public static final String IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD = 
"IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD";
-
     /**
      * When set to {@code true} BinaryObject will be unwrapped before passing 
to IndexingSpi to preserve
      * old behavior query processor with IndexingSpi.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java 
b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 992d1a99301..f21b0dc2cc9 100755
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -373,9 +373,6 @@ public abstract class IgniteUtils extends CommonUtils {
     /** Name of the JDK. */
     private static String jdkName;
 
-    /** Version of the JDK. */
-    private static String jdkVer;
-
     /** Name of the JVM implementation. */
     private static String jvmImplName;
 
@@ -588,7 +585,6 @@ public abstract class IgniteUtils extends CommonUtils {
         String javaRtName = System.getProperty("java.runtime.name");
         String javaRtVer = System.getProperty("java.runtime.version");
         String jdkName = System.getProperty("java.specification.name");
-        String jdkVer = System.getProperty("java.specification.version");
         String osVer = System.getProperty("os.version");
         String jvmImplVer = System.getProperty("java.vm.version");
         String jvmImplVendor = System.getProperty("java.vm.vendor");
@@ -604,7 +600,6 @@ public abstract class IgniteUtils extends CommonUtils {
 
         // Copy auto variables to static ones.
         IgniteUtils.jdkName = jdkName;
-        IgniteUtils.jdkVer = jdkVer;
         IgniteUtils.jdkStr = jdkStr;
         IgniteUtils.jvmImplName = jvmImplName;
 
@@ -5731,15 +5726,6 @@ public abstract class IgniteUtils extends CommonUtils {
         return linux;
     }
 
-    /**
-     * Gets JDK version.
-     *
-     * @return JDK version.
-     */
-    public static String jdkVersion() {
-        return jdkVer;
-    }
-
     /**
      * Indicates whether current OS is Mac OS.
      *
@@ -5801,33 +5787,6 @@ public abstract class IgniteUtils extends CommonUtils {
         return IgniteProductVersion.fromString(verStr);
     }
 
-    /**
-     * Get major Java version from string.
-     *
-     * @param verStr Version string.
-     * @return Major version or zero if failed to resolve.
-     */
-    public static int majorJavaVersion(String verStr) {
-        if (F.isEmpty(verStr))
-            return 0;
-
-        try {
-            String[] parts = verStr.split("\\.");
-
-            int major = Integer.parseInt(parts[0]);
-
-            if (parts.length == 1)
-                return major;
-
-            int minor = Integer.parseInt(parts[1]);
-
-            return major == 1 ? minor : major;
-        }
-        catch (Exception e) {
-            return 0;
-        }
-    }
-
     /**
      * Sets thread context class loader to the given loader, executes the 
closure, and then
      * resets thread context class loader to its initial value.
@@ -8837,28 +8796,6 @@ public abstract class IgniteUtils extends CommonUtils {
         return cnt;
     }
 
-    /**
-     * @param x X.
-     * @param less Less.
-     */
-    public static int nearestPow2(int x, boolean less) {
-        assert x > 0 : "can not calculate for less zero";
-
-        long y = 1;
-
-        while (y < x) {
-            if (y * 2 > Integer.MAX_VALUE)
-                return (int)y;
-
-            y *= 2;
-        }
-
-        if (less)
-            y /= 2;
-
-        return (int)y;
-    }
-
     /**
      * Puts additional text to thread name.
      * Calls {@code enhanceThreadName(Thread.currentThread(), text)}.
diff --git a/modules/dev-utils/pom.xml b/modules/dev-utils/pom.xml
index 0f619cae4e2..2663d0ef102 100644
--- a/modules/dev-utils/pom.xml
+++ b/modules/dev-utils/pom.xml
@@ -52,6 +52,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-grid-unsafe</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>ignite-core</artifactId>
diff --git a/modules/direct-io/pom.xml b/modules/direct-io/pom.xml
index 84b482fbb4c..d95c85a4f4a 100644
--- a/modules/direct-io/pom.xml
+++ b/modules/direct-io/pom.xml
@@ -42,6 +42,12 @@
             <artifactId>ignite-core</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-grid-unsafe</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>ignite-core</artifactId>
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index b146e5a1136..4a251896805 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -52,6 +52,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-grid-unsafe</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
diff --git a/modules/unsafe/pom.xml b/modules/unsafe/pom.xml
new file mode 100644
index 00000000000..d5ddf75a605
--- /dev/null
+++ b/modules/unsafe/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent-internal</artifactId>
+        <version>${revision}</version>
+        <relativePath>../../parent-internal/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>ignite-grid-unsafe</artifactId>
+
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>ignite-commons</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jetbrains</groupId>
+            <artifactId>annotations</artifactId>
+            <version>${jetbrains.annotations.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <version>2.8.2</version>
+                <configuration>
+                    <skip>false</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/DirectBufferCleaner.java
 
b/modules/unsafe/src/main/java/org/apache/ignite/internal/util/DirectBufferCleaner.java
similarity index 100%
rename from 
modules/core/src/main/java/org/apache/ignite/internal/util/DirectBufferCleaner.java
rename to 
modules/unsafe/src/main/java/org/apache/ignite/internal/util/DirectBufferCleaner.java
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/FeatureChecker.java
 
b/modules/unsafe/src/main/java/org/apache/ignite/internal/util/FeatureChecker.java
similarity index 100%
rename from 
modules/core/src/main/java/org/apache/ignite/internal/util/FeatureChecker.java
rename to 
modules/unsafe/src/main/java/org/apache/ignite/internal/util/FeatureChecker.java
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java 
b/modules/unsafe/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
similarity index 98%
rename from 
modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
rename to 
modules/unsafe/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
index 3a6b0aee4ba..7b86f1a5eca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
+++ 
b/modules/unsafe/src/main/java/org/apache/ignite/internal/util/GridUnsafe.java
@@ -28,15 +28,17 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.IgniteCommonsSystemProperties;
 import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import sun.misc.Unsafe;
 
-import static org.apache.ignite.internal.util.IgniteUtils.jdkVersion;
-import static org.apache.ignite.internal.util.IgniteUtils.majorJavaVersion;
+import static 
org.apache.ignite.IgniteCommonsSystemProperties.IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD;
+import static 
org.apache.ignite.IgniteCommonsSystemProperties.IGNITE_MEMORY_UNALIGNED_ACCESS;
+import static 
org.apache.ignite.internal.util.CommonUtils.DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD;
+import static org.apache.ignite.internal.util.CommonUtils.jdkVersion;
+import static org.apache.ignite.internal.util.CommonUtils.majorJavaVersion;
 
 /**
  * <p>Wrapper for {@link sun.misc.Unsafe} class.</p>
@@ -72,12 +74,9 @@ public abstract class GridUnsafe {
     /** Unaligned flag. */
     private static final boolean UNALIGNED = unaligned();
 
-    /** @see IgniteSystemProperties#IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD */
-    public static final long DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD = 0L;
-
     /** Per-byte copy threshold. */
-    private static final long PER_BYTE_THRESHOLD = 
IgniteSystemProperties.getLong(
-        IgniteSystemProperties.IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD, 
DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD);
+    private static final long PER_BYTE_THRESHOLD = 
IgniteCommonsSystemProperties.getLong(
+        IGNITE_MEMORY_PER_BYTE_COPY_THRESHOLD, 
DFLT_MEMORY_PER_BYTE_COPY_THRESHOLD);
 
     /** Big endian. */
     public static final boolean BIG_ENDIAN = ByteOrder.nativeOrder() == 
ByteOrder.BIG_ENDIAN;
@@ -1566,7 +1565,7 @@ public abstract class GridUnsafe {
     public static long calcAlign() {
         // Note: Alignment can also be set explicitly by 
-XX:ObjectAlignmentInBytes JVM property.
         return OBJ_REF_SIZE == 8L ? 8L :
-            U.nearestPow2(Math.max(8, (int)(Runtime.getRuntime().maxMemory() 
>> 32)), false);
+            CommonUtils.nearestPow2(Math.max(8, 
(int)(Runtime.getRuntime().maxMemory() >> 32)), false);
     }
 
     /** Calculate size with alignment. */
@@ -1583,7 +1582,7 @@ public abstract class GridUnsafe {
         boolean res = arch.equals("i386") || arch.equals("x86") || 
arch.equals("amd64") || arch.equals("x86_64");
 
         if (!res)
-            res = 
IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_MEMORY_UNALIGNED_ACCESS,
 false);
+            res = 
IgniteCommonsSystemProperties.getBoolean(IGNITE_MEMORY_UNALIGNED_ACCESS, false);
 
         return res;
     }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/UnsafeDirectBufferCleaner.java
 
b/modules/unsafe/src/main/java/org/apache/ignite/internal/util/UnsafeDirectBufferCleaner.java
similarity index 100%
rename from 
modules/core/src/main/java/org/apache/ignite/internal/util/UnsafeDirectBufferCleaner.java
rename to 
modules/unsafe/src/main/java/org/apache/ignite/internal/util/UnsafeDirectBufferCleaner.java
diff --git a/pom.xml b/pom.xml
index 2914021fd86..c836eea88e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
         <module>modules/tools</module>
         <module>modules/commons</module>
         <module>modules/binary/api</module>
+        <module>modules/unsafe</module>
         <module>modules/core</module>
         <module>modules/compress</module>
         <module>modules/dev-utils</module>

Reply via email to