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 5b5e0e423ae IGNITE-29156 Remove BinaryReaderHandlesHolder interface
from ignite-binary-api (#13697)
5b5e0e423ae is described below
commit 5b5e0e423ae61f2123b557e1e44b472368efe2c5
Author: Nikolay <[email protected]>
AuthorDate: Fri Oct 16 22:55:42 2026 +0300
IGNITE-29156 Remove BinaryReaderHandlesHolder interface from
ignite-binary-api (#13697)
---
.../ignite/internal/binary/BinaryReaderEx.java | 2 +-
.../internal/binary/BinaryReaderHandlesHolder.java | 49 ----------------------
.../ignite/internal/binary/BinaryReaderExImpl.java | 35 +++-------------
.../binary/BinaryReaderHandlesHolder.java} | 45 +++++++++++++++-----
4 files changed, 40 insertions(+), 91 deletions(-)
diff --git
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderEx.java
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderEx.java
index 9b6c6688fb3..8cf141fbd38 100644
---
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderEx.java
+++
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderEx.java
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Extended reader interface.
*/
-public interface BinaryReaderEx extends BinaryReader, BinaryRawReader,
BinaryReaderHandlesHolder, ObjectInput {
+public interface BinaryReaderEx extends BinaryReader, BinaryRawReader,
ObjectInput {
/**
* @return Object.
* @throws org.apache.ignite.binary.BinaryObjectException In case of error.
diff --git
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolder.java
b/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolder.java
deleted file mode 100644
index 5308d9e0766..00000000000
---
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolder.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.binary;
-
-/**
- * Holder for handles.
- */
-interface BinaryReaderHandlesHolder {
- /**
- * Set handle.
- *
- * @param obj Object.
- * @param pos Position.
- */
- public void setHandle(Object obj, int pos);
-
- /**
- * Get handle.
- *
- * @param pos Position.
- * @return Handle.
- */
- public Object getHandle(int pos);
-
- /**
- * Get all handles.
- *
- * @return Handles.
- */
- public BinaryReaderHandles handles();
-
- /** */
- public boolean isEmpty();
-}
diff --git
a/modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
b/modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
index a705c0ca9ed..0b5f85ed034 100644
---
a/modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
+++
b/modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
@@ -103,7 +103,7 @@ import static
org.apache.ignite.internal.binary.GridBinaryMarshaller.UUID_ARR;
* Binary reader implementation.
*/
@SuppressWarnings("unchecked")
-public class BinaryReaderExImpl implements BinaryReaderEx {
+public class BinaryReaderExImpl extends BinaryReaderHandlesHolder implements
BinaryReaderEx {
/** Binary context. */
private final BinaryContext ctx;
@@ -113,9 +113,6 @@ public class BinaryReaderExImpl implements BinaryReaderEx {
/** Class loaded. */
private final ClassLoader ldr;
- /** Reader context which is constantly passed between objects. */
- private BinaryReaderHandles hnds;
-
/** */
private final int start;
@@ -219,10 +216,11 @@ public class BinaryReaderExImpl implements BinaryReaderEx
{
boolean skipHdrCheck,
boolean forUnmarshal) {
// Initialize base members.
+ super(hnds);
+
this.ctx = ctx;
this.in = in;
this.ldr = ldr;
- this.hnds = hnds;
start = in.position();
@@ -393,24 +391,6 @@ public class BinaryReaderExImpl implements BinaryReaderEx {
return null;
}
- /** {@inheritDoc} */
- @Override public void setHandle(Object obj, int pos) {
- handles().put(pos, obj);
- }
-
- /** {@inheritDoc} */
- @Override public Object getHandle(int pos) {
- return hnds != null ? hnds.get(pos) : null;
- }
-
- /** {@inheritDoc} */
- @Override public BinaryReaderHandles handles() {
- if (hnds == null)
- hnds = new BinaryReaderHandles();
-
- return hnds;
- }
-
/**
* Recreating field value from a handle.
*
@@ -1338,7 +1318,7 @@ public class BinaryReaderExImpl implements BinaryReaderEx
{
/** {@inheritDoc} */
@Nullable @Override public Object readObjectDetached(boolean deserialize)
throws BinaryObjectException {
- return unmarshal(in, ctx, ldr, new BinaryReaderHandlesHolderImpl(),
true, deserialize);
+ return unmarshal(in, ctx, ldr, new BinaryReaderHandlesHolder(null),
true, deserialize);
}
/** {@inheritDoc} */
@@ -2470,11 +2450,6 @@ public class BinaryReaderExImpl implements
BinaryReaderEx {
return in.remaining();
}
- /** {@inheritDoc} */
- @Override public boolean isEmpty() {
- return hnds == null || hnds.isEmpty();
- }
-
/** {@inheritDoc} */
@Override public void close() throws IOException {
// No-op.
@@ -3399,7 +3374,7 @@ public class BinaryReaderExImpl implements BinaryReaderEx
{
*/
@Nullable static Object unmarshal(BinaryInputStream in, BinaryContext ctx,
ClassLoader ldr)
throws BinaryObjectException {
- return unmarshal(in, ctx, ldr, new BinaryReaderHandlesHolderImpl());
+ return unmarshal(in, ctx, ldr, new BinaryReaderHandlesHolder(null));
}
/**
diff --git
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolderImpl.java
b/modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolder.java
similarity index 58%
rename from
modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolderImpl.java
rename to
modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolder.java
index 6adb2f2f1a7..262216b8b0c 100644
---
a/modules/binary/api/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolderImpl.java
+++
b/modules/binary/impl/src/main/java/org/apache/ignite/internal/binary/BinaryReaderHandlesHolder.java
@@ -17,33 +17,56 @@
package org.apache.ignite.internal.binary;
+import org.jetbrains.annotations.Nullable;
+
/**
* Simple holder for handles.
*/
-class BinaryReaderHandlesHolderImpl implements BinaryReaderHandlesHolder {
- /** Handles. */
- private BinaryReaderHandles hnds;
+class BinaryReaderHandlesHolder {
+ /** Reader context which is constantly passed between objects. */
+ BinaryReaderHandles hnds;
+
+ /**
+ * @param hnds Handles.
+ */
+ BinaryReaderHandlesHolder(@Nullable BinaryReaderHandles hnds) {
+ this.hnds = hnds;
+ }
- /** {@inheritDoc} */
- @Override public void setHandle(Object obj, int pos) {
+ /**
+ * Set handle.
+ *
+ * @param obj Object.
+ * @param pos Position.
+ */
+ final void setHandle(Object obj, int pos) {
handles().put(pos, obj);
}
- /** {@inheritDoc} */
- @Override public Object getHandle(int pos) {
+ /**
+ * Get handle.
+ *
+ * @param pos Position.
+ * @return Handle.
+ */
+ final Object getHandle(int pos) {
return hnds != null ? hnds.get(pos) : null;
}
- /** {@inheritDoc} */
- @Override public BinaryReaderHandles handles() {
+ /**
+ * Get all handles.
+ *
+ * @return Handles.
+ */
+ public final BinaryReaderHandles handles() {
if (hnds == null)
hnds = new BinaryReaderHandles();
return hnds;
}
- /** {@inheritDoc} */
- @Override public boolean isEmpty() {
+ /** @return {@code True} if no handles were registered. */
+ final boolean isEmpty() {
return hnds == null || hnds.isEmpty();
}
}