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 a311a82b05c IGNITE-27541 Move CacheObjectUtils#putValue to 
CacheObjectUnsafeUtils (#12627)
a311a82b05c is described below

commit a311a82b05cc588b3cbb481b4f92b206cc4efa7a
Author: Nikolay <[email protected]>
AuthorDate: Tue Jan 13 14:47:22 2026 +0300

    IGNITE-27541 Move CacheObjectUtils#putValue to CacheObjectUnsafeUtils 
(#12627)
---
 .../internal/binary/BinaryEnumObjectImpl.java      |  3 +-
 .../ignite/internal/binary/BinaryObjectImpl.java   |  5 +-
 .../processors/cache/CacheObjectUtils.java         | 34 -------------
 .../processors/cache/CacheObjectAdapter.java       |  3 +-
 .../processors/cache/CacheObjectByteArrayImpl.java |  3 +-
 .../internal/util/CacheObjectUnsafeUtils.java      | 58 ++++++++++++++++++++++
 6 files changed, 67 insertions(+), 39 deletions(-)

diff --git 
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
 
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index 813ff1ca112..d8655ed1277 100644
--- 
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ 
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -30,6 +30,7 @@ import org.apache.ignite.binary.BinaryType;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.CacheObjectUtils;
 import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
+import org.apache.ignite.internal.util.CacheObjectUnsafeUtils;
 import org.apache.ignite.internal.util.CommonUtils;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -337,7 +338,7 @@ class BinaryEnumObjectImpl implements BinaryObjectEx, 
Externalizable, CacheObjec
     @Override public int putValue(long addr) throws IgniteCheckedException {
         assert valBytes != null : "Value bytes must be initialized before 
object is stored";
 
-        return CacheObjectUtils.putValue(addr, cacheObjectType(), valBytes);
+        return CacheObjectUnsafeUtils.putValue(addr, cacheObjectType(), 
valBytes);
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
 
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index 683f413e694..5b49de598de 100644
--- 
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ 
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -38,6 +38,7 @@ import 
org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.CacheObjectUtils;
 import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.util.CacheObjectUnsafeUtils;
 import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.marshaller.Marshallers;
@@ -201,8 +202,8 @@ final class BinaryObjectImpl extends BinaryObjectExImpl 
implements Externalizabl
     }
 
     /** {@inheritDoc} */
-    @Override public int putValue(long addr) throws IgniteCheckedException {
-        return CacheObjectUtils.putValue(addr, cacheObjectType(), valBytes, 0, 
valBytes.length);
+    @Override public int putValue(long addr) {
+        return CacheObjectUnsafeUtils.putValue(addr, cacheObjectType(), 
valBytes, 0, valBytes.length);
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/binary/api/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectUtils.java
 
b/modules/binary/api/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectUtils.java
index aab48ffed1a..e33e2c12f53 100644
--- 
a/modules/binary/api/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectUtils.java
+++ 
b/modules/binary/api/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectUtils.java
@@ -24,7 +24,6 @@ import java.util.Map;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.internal.binary.BinaryUtils;
-import org.apache.ignite.internal.pagemem.PageUtils;
 import org.apache.ignite.internal.util.CommonUtils;
 import org.apache.ignite.internal.util.MutableSingletonList;
 import org.apache.ignite.internal.util.typedef.F;
@@ -225,39 +224,6 @@ public class CacheObjectUtils {
         return dataLen + HEAD_SIZE;
     }
 
-    /**
-     * @param addr Write address.
-     * @param type Object type.
-     * @param valBytes Value bytes array.
-     * @return Offset shift compared to initial address.
-     */
-    public static int putValue(long addr, byte type, byte[] valBytes) {
-        return putValue(addr, type, valBytes, 0, valBytes.length);
-    }
-
-    /**
-     * @param addr Write address.
-     * @param type Object type.
-     * @param srcBytes Source value bytes array.
-     * @param srcOff Start position in sourceBytes.
-     * @param len Number of bytes for write.
-     * @return Offset shift compared to initial address.
-     */
-    public static int putValue(long addr, byte type, byte[] srcBytes, int 
srcOff, int len) {
-        int off = 0;
-
-        PageUtils.putInt(addr, off, len);
-        off += 4;
-
-        PageUtils.putByte(addr, off, type);
-        off++;
-
-        PageUtils.putBytes(addr, off, srcBytes, srcOff, len);
-        off += len;
-
-        return off;
-    }
-
     /**
      * @param cacheObjType Cache object type.
      * @param buf Buffer to write value to.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
index 522ae7d5b0f..6db3708adda 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectAdapter.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
 import java.nio.ByteBuffer;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.binary.BinaryUtils;
+import org.apache.ignite.internal.util.CacheObjectUnsafeUtils;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -98,7 +99,7 @@ public abstract class CacheObjectAdapter implements 
CacheObject, Externalizable
     @Override public int putValue(long addr) throws IgniteCheckedException {
         assert valBytes != null : "Value bytes must be initialized before 
object is stored";
 
-        return CacheObjectUtils.putValue(addr, cacheObjectType(), valBytes);
+        return CacheObjectUnsafeUtils.putValue(addr, cacheObjectType(), 
valBytes);
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
index 5c7c3f25cfa..2119c99b9c1 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheObjectByteArrayImpl.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.util.CacheObjectUnsafeUtils;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.jetbrains.annotations.Nullable;
@@ -86,7 +87,7 @@ public class CacheObjectByteArrayImpl implements CacheObject, 
Externalizable {
 
     /** {@inheritDoc} */
     @Override public int putValue(long addr) throws IgniteCheckedException {
-        return CacheObjectUtils.putValue(addr, cacheObjectType(), val);
+        return CacheObjectUnsafeUtils.putValue(addr, cacheObjectType(), val);
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/unsafe/src/main/java/org/apache/ignite/internal/util/CacheObjectUnsafeUtils.java
 
b/modules/unsafe/src/main/java/org/apache/ignite/internal/util/CacheObjectUnsafeUtils.java
new file mode 100644
index 00000000000..6e8864380aa
--- /dev/null
+++ 
b/modules/unsafe/src/main/java/org/apache/ignite/internal/util/CacheObjectUnsafeUtils.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.util;
+
+import org.apache.ignite.internal.pagemem.PageUtils;
+
+/**
+ * Cache object utility methods.
+ */
+public class CacheObjectUnsafeUtils {
+    /**
+     * @param addr Write address.
+     * @param type Object type.
+     * @param valBytes Value bytes array.
+     * @return Offset shift compared to initial address.
+     */
+    public static int putValue(long addr, byte type, byte[] valBytes) {
+        return putValue(addr, type, valBytes, 0, valBytes.length);
+    }
+
+    /**
+     * @param addr Write address.
+     * @param type Object type.
+     * @param srcBytes Source value bytes array.
+     * @param srcOff Start position in sourceBytes.
+     * @param len Number of bytes for write.
+     * @return Offset shift compared to initial address.
+     */
+    public static int putValue(long addr, byte type, byte[] srcBytes, int 
srcOff, int len) {
+        int off = 0;
+
+        PageUtils.putInt(addr, off, len);
+        off += 4;
+
+        PageUtils.putByte(addr, off, type);
+        off++;
+
+        PageUtils.putBytes(addr, off, srcBytes, srcOff, len);
+        off += len;
+
+        return off;
+    }
+}

Reply via email to