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 f911e7f347f IGNITE-26126 BinaryContext dependencies moved to commons
and binary-api (#12249)
f911e7f347f is described below
commit f911e7f347fe2f99121ecc5adec1ec8ee93f8002
Author: Nikolay <[email protected]>
AuthorDate: Tue Aug 5 17:15:54 2025 +0300
IGNITE-26126 BinaryContext dependencies moved to commons and binary-api
(#12249)
---
.../java/org/apache/ignite/lang/IgniteUuid.java | 8 +-
.../ignite/internal/DuplicateTypeIdException.java | 0
.../internal/UnregisteredClassException.java | 0
.../apache/ignite/internal/util/CommonUtils.java | 121 +++++++++++++++++++++
.../util/GridBoundedConcurrentLinkedHashMap.java | 0
.../ignite/internal/util/IgniteUuidCache.java | 0
.../ignite/internal/util/lang/GridMapEntry.java | 0
.../main/java/org/jsr166/ConcurrentHashMap8.java | 0
.../java/org/jsr166/ConcurrentLinkedDeque8.java | 0
.../java/org/jsr166/ConcurrentLinkedHashMap.java | 0
.../src/main/java/org/jsr166/README.txt | 0
.../src/main/java/org/jsr166/package-info.java | 0
.../apache/ignite/internal/util/IgniteUtils.java | 116 --------------------
13 files changed, 125 insertions(+), 120 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
b/modules/binary/api/src/main/java/org/apache/ignite/lang/IgniteUuid.java
similarity index 96%
rename from modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
rename to
modules/binary/api/src/main/java/org/apache/ignite/lang/IgniteUuid.java
index 73ab127cebe..cbd3f517f9b 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
+++ b/modules/binary/api/src/main/java/org/apache/ignite/lang/IgniteUuid.java
@@ -30,10 +30,10 @@ import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.CommonUtils;
import org.apache.ignite.internal.util.lang.GridIterator;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.U;
/**
* This is a faster performing version of {@link UUID}. On basic tests this
version is at least
@@ -48,7 +48,7 @@ public final class IgniteUuid implements
Comparable<IgniteUuid>, Iterable<Ignite
public static final UUID VM_ID = UUID.randomUUID();
/** */
- private static final AtomicLong cntGen = new
AtomicLong(U.currentTimeMillis());
+ private static final AtomicLong cntGen = new
AtomicLong(CommonUtils.currentTimeMillis());
/** */
private UUID gid;
@@ -161,14 +161,14 @@ public final class IgniteUuid implements
Comparable<IgniteUuid>, Iterable<Ignite
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeUuid(out, gid);
+ CommonUtils.writeUuid(out, gid);
out.writeLong(locId);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException {
- gid = U.readUuid(in);
+ gid = CommonUtils.readUuid(in);
locId = in.readLong();
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java
b/modules/commons/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/UnregisteredClassException.java
b/modules/commons/src/main/java/org/apache/ignite/internal/UnregisteredClassException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/UnregisteredClassException.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/UnregisteredClassException.java
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 3eef1ac12d2..820035ac29d 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
@@ -17,12 +17,17 @@
package org.apache.ignite.internal.util;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.Externalizable;
+import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ServiceLoader;
+import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCommonsSystemProperties;
@@ -67,6 +72,18 @@ public abstract class CommonUtils {
/** Version of the JDK. */
static String jdkVer;
+ /** */
+ static volatile long curTimeMillis = System.currentTimeMillis();
+
+ /** Clock timer. */
+ private static Thread timer;
+
+ /** Grid counter. */
+ static int gridCnt;
+
+ /** Mutex. */
+ static final Object mux = new Object();
+
static {
try {
OBJECT_CTOR = Object.class.getConstructor();
@@ -334,4 +351,108 @@ public abstract class CommonUtils {
return 1 << (32 - Integer.numberOfLeadingZeros(v - 1));
}
+
+ /**
+ * @return System time approximated by 10 ms.
+ */
+ public static long currentTimeMillis() {
+ return curTimeMillis;
+ }
+
+ /**
+ * Starts clock timer if grid is first.
+ */
+ public static void onGridStart() {
+ synchronized (mux) {
+ if (gridCnt == 0) {
+ assert timer == null;
+
+ timer = new Thread(new Runnable() {
+ @SuppressWarnings({"BusyWait"})
+ @Override public void run() {
+ while (true) {
+ curTimeMillis = System.currentTimeMillis();
+
+ try {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException ignored) {
+ break;
+ }
+ }
+ }
+ }, "ignite-clock");
+
+ timer.setDaemon(true);
+
+ timer.setPriority(10);
+
+ timer.start();
+ }
+
+ ++gridCnt;
+ }
+ }
+
+ /**
+ * Stops clock timer if all nodes into JVM were stopped.
+ * @throws InterruptedException If interrupted.
+ */
+ public static void onGridStop() throws InterruptedException {
+ synchronized (mux) {
+ // Grid start may fail and onGridStart() does not get called.
+ if (gridCnt == 0)
+ return;
+
+ --gridCnt;
+
+ Thread timer0 = timer;
+
+ if (gridCnt == 0 && timer0 != null) {
+ timer = null;
+
+ timer0.interrupt();
+
+ timer0.join();
+ }
+ }
+ }
+
+ /**
+ * Writes UUID to output stream. This method is meant to be used by
+ * implementations of {@link Externalizable} interface.
+ *
+ * @param out Output stream.
+ * @param uid UUID to write.
+ * @throws IOException If write failed.
+ */
+ public static void writeUuid(DataOutput out, UUID uid) throws IOException {
+ // Write null flag.
+ out.writeBoolean(uid == null);
+
+ if (uid != null) {
+ out.writeLong(uid.getMostSignificantBits());
+ out.writeLong(uid.getLeastSignificantBits());
+ }
+ }
+
+ /**
+ * Reads UUID from input stream. This method is meant to be used by
+ * implementations of {@link Externalizable} interface.
+ *
+ * @param in Input stream.
+ * @return Read UUID.
+ * @throws IOException If read failed.
+ */
+ @Nullable public static UUID readUuid(DataInput in) throws IOException {
+ // If UUID is not null.
+ if (!in.readBoolean()) {
+ long most = in.readLong();
+ long least = in.readLong();
+
+ return IgniteUuidCache.onIgniteUuidRead(new UUID(most, least));
+ }
+
+ return null;
+ }
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedConcurrentLinkedHashMap.java
b/modules/commons/src/main/java/org/apache/ignite/internal/util/GridBoundedConcurrentLinkedHashMap.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/util/GridBoundedConcurrentLinkedHashMap.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/util/GridBoundedConcurrentLinkedHashMap.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java
b/modules/commons/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/util/IgniteUuidCache.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridMapEntry.java
b/modules/commons/src/main/java/org/apache/ignite/internal/util/lang/GridMapEntry.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridMapEntry.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/util/lang/GridMapEntry.java
diff --git a/modules/core/src/main/java/org/jsr166/ConcurrentHashMap8.java
b/modules/commons/src/main/java/org/jsr166/ConcurrentHashMap8.java
similarity index 100%
rename from modules/core/src/main/java/org/jsr166/ConcurrentHashMap8.java
rename to modules/commons/src/main/java/org/jsr166/ConcurrentHashMap8.java
diff --git a/modules/core/src/main/java/org/jsr166/ConcurrentLinkedDeque8.java
b/modules/commons/src/main/java/org/jsr166/ConcurrentLinkedDeque8.java
similarity index 100%
rename from modules/core/src/main/java/org/jsr166/ConcurrentLinkedDeque8.java
rename to modules/commons/src/main/java/org/jsr166/ConcurrentLinkedDeque8.java
diff --git a/modules/core/src/main/java/org/jsr166/ConcurrentLinkedHashMap.java
b/modules/commons/src/main/java/org/jsr166/ConcurrentLinkedHashMap.java
similarity index 100%
rename from modules/core/src/main/java/org/jsr166/ConcurrentLinkedHashMap.java
rename to modules/commons/src/main/java/org/jsr166/ConcurrentLinkedHashMap.java
diff --git a/modules/core/src/main/java/org/jsr166/README.txt
b/modules/commons/src/main/java/org/jsr166/README.txt
similarity index 100%
rename from modules/core/src/main/java/org/jsr166/README.txt
rename to modules/commons/src/main/java/org/jsr166/README.txt
diff --git a/modules/core/src/main/java/org/jsr166/package-info.java
b/modules/commons/src/main/java/org/jsr166/package-info.java
similarity index 100%
rename from modules/core/src/main/java/org/jsr166/package-info.java
rename to modules/commons/src/main/java/org/jsr166/package-info.java
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 2b81740c28e..a0a391e6334 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
@@ -430,9 +430,6 @@ public abstract class IgniteUtils extends CommonUtils {
/** Supplier of network interfaces. Could be used for tests purposes, must
not be changed in production code. */
public static InterfaceSupplier INTERFACE_SUPPLIER =
NetworkInterface::getNetworkInterfaces;
- /** */
- static volatile long curTimeMillis = System.currentTimeMillis();
-
/** Primitive class map. */
private static final Map<String, Class<?>> primitiveMap = new
HashMap<>(16, .5f);
@@ -458,15 +455,6 @@ public abstract class IgniteUtils extends CommonUtils {
/** Random is used to get random server node to authentication from client
node. */
private static final Random RND = new Random(System.currentTimeMillis());
- /** Clock timer. */
- private static Thread timer;
-
- /** Grid counter. */
- static int gridCnt;
-
- /** Mutex. */
- static final Object mux = new Object();
-
/** Exception converters. */
private static final Map<Class<? extends IgniteCheckedException>,
C1<IgniteCheckedException, IgniteException>>
exceptionConverters;
@@ -936,13 +924,6 @@ public abstract class IgniteUtils extends CommonUtils {
return new IgniteException(e.getMessage(), e);
}
- /**
- * @return System time approximated by 10 ms.
- */
- public static long currentTimeMillis() {
- return curTimeMillis;
- }
-
/**
* Gets name for given grid event type.
*
@@ -2760,65 +2741,6 @@ public abstract class IgniteUtils extends CommonUtils {
}
}
- /**
- * Starts clock timer if grid is first.
- */
- public static void onGridStart() {
- synchronized (mux) {
- if (gridCnt == 0) {
- assert timer == null;
-
- timer = new Thread(new Runnable() {
- @SuppressWarnings({"BusyWait"})
- @Override public void run() {
- while (true) {
- curTimeMillis = System.currentTimeMillis();
-
- try {
- Thread.sleep(10);
- }
- catch (InterruptedException ignored) {
- break;
- }
- }
- }
- }, "ignite-clock");
-
- timer.setDaemon(true);
-
- timer.setPriority(10);
-
- timer.start();
- }
-
- ++gridCnt;
- }
- }
-
- /**
- * Stops clock timer if all nodes into JVM were stopped.
- * @throws InterruptedException If interrupted.
- */
- public static void onGridStop() throws InterruptedException {
- synchronized (mux) {
- // Grid start may fail and onGridStart() does not get called.
- if (gridCnt == 0)
- return;
-
- --gridCnt;
-
- Thread timer0 = timer;
-
- if (gridCnt == 0 && timer0 != null) {
- timer = null;
-
- timer0.interrupt();
-
- timer0.join();
- }
- }
- }
-
/**
* Copies input byte stream to output byte stream.
*
@@ -4418,44 +4340,6 @@ public abstract class IgniteUtils extends CommonUtils {
return new ClusterGroupEmptyCheckedException("Cluster group is
empty.");
}
- /**
- * Writes UUID to output stream. This method is meant to be used by
- * implementations of {@link Externalizable} interface.
- *
- * @param out Output stream.
- * @param uid UUID to write.
- * @throws IOException If write failed.
- */
- public static void writeUuid(DataOutput out, UUID uid) throws IOException {
- // Write null flag.
- out.writeBoolean(uid == null);
-
- if (uid != null) {
- out.writeLong(uid.getMostSignificantBits());
- out.writeLong(uid.getLeastSignificantBits());
- }
- }
-
- /**
- * Reads UUID from input stream. This method is meant to be used by
- * implementations of {@link Externalizable} interface.
- *
- * @param in Input stream.
- * @return Read UUID.
- * @throws IOException If read failed.
- */
- @Nullable public static UUID readUuid(DataInput in) throws IOException {
- // If UUID is not null.
- if (!in.readBoolean()) {
- long most = in.readLong();
- long least = in.readLong();
-
- return IgniteUuidCache.onIgniteUuidRead(new UUID(most, least));
- }
-
- return null;
- }
-
/**
* Writes {@link org.apache.ignite.lang.IgniteUuid} to output stream. This
method is meant to be used by
* implementations of {@link Externalizable} interface.