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 0b5b218254d IGNITE-26250 Remove U dependency from binary package
(#12282)
0b5b218254d is described below
commit 0b5b218254dd49695e83ea1baa1319ffabc6ffa0
Author: Nikolay <[email protected]>
AuthorDate: Wed Aug 20 14:13:26 2025 +0300
IGNITE-26250 Remove U dependency from binary package (#12282)
---
.../ignite/IgniteClientDisconnectedException.java | 0
.../ignite/IgniteCommonsSystemProperties.java | 4 +
.../apache/ignite/IgniteInterruptedException.java | 0
.../IgniteClientDisconnectedCheckedException.java | 0
.../IgniteFutureCancelledCheckedException.java | 0
.../IgniteFutureTimeoutCheckedException.java | 0
.../apache/ignite/internal/util/CommonUtils.java | 487 ++++++++++++++++++++-
.../java/org/apache/ignite/lang/IgniteFuture.java | 0
.../lang/IgniteFutureCancelledException.java | 0
.../ignite/lang/IgniteFutureTimeoutException.java | 0
.../org/apache/ignite/IgniteSystemProperties.java | 4 -
.../ignite/internal/binary/BinaryContext.java | 3 +-
.../internal/binary/BinaryEnumObjectImpl.java | 4 +-
.../ignite/internal/binary/BinaryReaderExImpl.java | 3 +-
.../apache/ignite/internal/util/IgniteUtils.java | 457 +------------------
15 files changed, 495 insertions(+), 467 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/IgniteClientDisconnectedException.java
b/modules/commons/src/main/java/org/apache/ignite/IgniteClientDisconnectedException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/IgniteClientDisconnectedException.java
rename to
modules/commons/src/main/java/org/apache/ignite/IgniteClientDisconnectedException.java
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 64dcfd2274a..bafe987218f 100644
---
a/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java
+++
b/modules/commons/src/main/java/org/apache/ignite/IgniteCommonsSystemProperties.java
@@ -109,6 +109,10 @@ public class IgniteCommonsSystemProperties {
defaults = "" + DFLT_LOG_THROTTLE_CAPACITY)
public static final String IGNITE_LOG_THROTTLE_CAPACITY =
"IGNITE_LOG_THROTTLE_CAPACITY";
+ /** Defines Ignite installation folder. */
+ @SystemProperty(value = "Defines Ignite installation folder", type =
String.class, defaults = "")
+ public static final String IGNITE_HOME = "IGNITE_HOME";
+
/**
* @param enumCls Enum type.
* @param name Name of the system property or environment variable.
diff --git
a/modules/core/src/main/java/org/apache/ignite/IgniteInterruptedException.java
b/modules/commons/src/main/java/org/apache/ignite/IgniteInterruptedException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/IgniteInterruptedException.java
rename to
modules/commons/src/main/java/org/apache/ignite/IgniteInterruptedException.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteClientDisconnectedCheckedException.java
b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteClientDisconnectedCheckedException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/IgniteClientDisconnectedCheckedException.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/IgniteClientDisconnectedCheckedException.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteFutureCancelledCheckedException.java
b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteFutureCancelledCheckedException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/IgniteFutureCancelledCheckedException.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/IgniteFutureCancelledCheckedException.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteFutureTimeoutCheckedException.java
b/modules/commons/src/main/java/org/apache/ignite/internal/IgniteFutureTimeoutCheckedException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/internal/IgniteFutureTimeoutCheckedException.java
rename to
modules/commons/src/main/java/org/apache/ignite/internal/IgniteFutureTimeoutCheckedException.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 77612e671a2..3cadcdae1d2 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
@@ -20,22 +20,30 @@ package org.apache.ignite.internal.util;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.Externalizable;
+import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.UTFDataFormatException;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.DatagramSocket;
import java.net.Socket;
import java.net.SocketException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
import java.net.URLClassLoader;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
@@ -53,18 +61,30 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteCommonsSystemProperties;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
+import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
+import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.processors.cache.CacheClassLoaderMarker;
+import org.apache.ignite.internal.util.lang.GridTuple;
+import org.apache.ignite.internal.util.typedef.C1;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.SB;
+import org.apache.ignite.lang.IgniteFutureCancelledException;
+import org.apache.ignite.lang.IgniteFutureTimeoutException;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.Nullable;
import static java.util.Objects.isNull;
+import static org.apache.ignite.IgniteCommonsSystemProperties.IGNITE_HOME;
/**
* Collection of utility methods used in 'ignite-commons' and throughout the
system.
@@ -116,6 +136,9 @@ public abstract class CommonUtils {
/** Version of the JDK. */
static String jdkVer;
+ /** Project home directory. */
+ private static volatile GridTuple<String> ggHome;
+
/** */
static volatile long curTimeMillis = System.currentTimeMillis();
@@ -125,6 +148,39 @@ public abstract class CommonUtils {
/** Grid counter. */
static int gridCnt;
+ /** Indicates whether current OS is some version of Windows. */
+ private static boolean win;
+
+ /** Indicates whether current OS is UNIX flavor. */
+ private static boolean unix;
+
+ /** Indicates whether current OS is Linux flavor. */
+ private static boolean linux;
+
+ /** Indicates whether current OS is Mac OS. */
+ private static boolean mac;
+
+ /** Empty URL array. */
+ private static final URL[] EMPTY_URL_ARR = new URL[0];
+
+ /** Builtin class loader class.
+ *
+ * Note: needs for compatibility with Java 9.
+ */
+ private static final Class bltClsLdrCls = defaultClassLoaderClass();
+
+ /** Url class loader field.
+ *
+ * Note: needs for compatibility with Java 9.
+ */
+ private static final Field urlClsLdrField = urlClassLoaderField();
+
+ /** JDK9: jdk.internal.loader.URLClassPath. */
+ private static Class clsURLClassPath;
+
+ /** JDK9: URLClassPath#getURLs. */
+ private static Method mthdURLClassPathGetUrls;
+
/** Mutex. */
static final Object mux = new Object();
@@ -149,6 +205,10 @@ public abstract class CommonUtils {
public static final DateTimeFormatter SHORT_DATE_FMT =
DateTimeFormatter.ofPattern("HH:mm:ss").withZone(ZoneId.systemDefault());
+ /** Exception converters. */
+ private static final Map<Class<? extends IgniteCheckedException>,
C1<IgniteCheckedException, IgniteException>>
+ exceptionConverters = new HashMap<>();
+
/** Class loader used to load Ignite. */
private static final ClassLoader gridClassLoader =
CommonUtils.class.getClassLoader();
@@ -196,7 +256,39 @@ public abstract class CommonUtils {
CTOR_FACTORY = ctorFac;
SUN_REFLECT_FACTORY = refFac;
- CommonUtils.jdkVer = System.getProperty("java.specification.version");
+ jdkVer = System.getProperty("java.specification.version");
+
+ String osName = System.getProperty("os.name");
+ String osLow = osName.toLowerCase();
+
+ // OS type detection.
+ if (osLow.contains("win"))
+ win = true;
+ else if (osLow.contains("mac os"))
+ mac = true;
+ else {
+ // UNIXs flavors tokens.
+ for (CharSequence os : new String[] {"ix", "inux", "olaris", "un",
"ux", "sco", "bsd", "att"})
+ if (osLow.contains(os)) {
+ unix = true;
+
+ break;
+ }
+
+ if (osLow.contains("inux"))
+ linux = true;
+ }
+
+ addExceptionConverters(exceptionConverters());
+
+ try {
+ clsURLClassPath =
Class.forName("jdk.internal.loader.URLClassPath");
+ mthdURLClassPathGetUrls = clsURLClassPath.getMethod("getURLs");
+ }
+ catch (ReflectiveOperationException e) {
+ clsURLClassPath = null;
+ mthdURLClassPathGetUrls = null;
+ }
}
/**
@@ -1586,6 +1678,290 @@ public abstract class CommonUtils {
return (c >= 0x0001 && c <= 0x007F) ? 1 : (c > 0x07FF) ? 3 : 2;
}
+ /**
+ * Retrieves {@code IGNITE_HOME} property. The property is retrieved from
system
+ * properties or from environment in that order.
+ *
+ * @return {@code IGNITE_HOME} property.
+ */
+ @Nullable public static String getIgniteHome() {
+ GridTuple<String> ggHomeTup = ggHome;
+
+ String ggHome0;
+
+ if (ggHomeTup == null) {
+ synchronized (CommonUtils.class) {
+ // Double check.
+ ggHomeTup = ggHome;
+
+ if (ggHomeTup == null) {
+ // Resolve Ignite installation home directory.
+ ggHome = F.t(ggHome0 = resolveProjectHome());
+
+ if (ggHome0 != null)
+ System.setProperty(IGNITE_HOME, ggHome0);
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+ }
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+
+ return ggHome0;
+ }
+
+ /**
+ * Resolve project home directory based on source code base.
+ *
+ * @return Project home directory (or {@code null} if it cannot be
resolved).
+ */
+ @Nullable private static String resolveProjectHome() {
+ assert Thread.holdsLock(CommonUtils.class);
+
+ // Resolve Ignite home via environment variables.
+ String ggHome0 = IgniteCommonsSystemProperties.getString(IGNITE_HOME);
+
+ if (!F.isEmpty(ggHome0))
+ return ggHome0;
+
+ String appWorkDir = System.getProperty("user.dir");
+
+ if (appWorkDir != null) {
+ ggHome0 = findProjectHome(new File(appWorkDir));
+
+ if (ggHome0 != null)
+ return ggHome0;
+ }
+
+ URI classesUri;
+
+ Class<CommonUtils> cls = CommonUtils.class;
+
+ try {
+ ProtectionDomain domain = cls.getProtectionDomain();
+
+ // Should not happen, but to make sure our code is not broken.
+ if (domain == null || domain.getCodeSource() == null ||
domain.getCodeSource().getLocation() == null) {
+ logResolveFailed(cls, null);
+
+ return null;
+ }
+
+ // Resolve path to class-file.
+ classesUri = domain.getCodeSource().getLocation().toURI();
+
+ // Overcome UNC path problem on Windows
(http://www.tomergabel.com/JavaMishandlesUNCPathsOnWindows.aspx)
+ if (isWindows() && classesUri.getAuthority() != null)
+ classesUri = new URI(classesUri.toString().replace("file://",
"file:/"));
+ }
+ catch (URISyntaxException | SecurityException e) {
+ logResolveFailed(cls, e);
+
+ return null;
+ }
+
+ File classesFile;
+
+ try {
+ classesFile = new File(classesUri);
+ }
+ catch (IllegalArgumentException e) {
+ logResolveFailed(cls, e);
+
+ return null;
+ }
+
+ return findProjectHome(classesFile);
+ }
+
+ /**
+ * Tries to find project home starting from specified directory and moving
to root.
+ *
+ * @param startDir First directory in search hierarchy.
+ * @return Project home path or {@code null} if it wasn't found.
+ */
+ private static String findProjectHome(File startDir) {
+ for (File cur = startDir.getAbsoluteFile(); cur != null; cur =
cur.getParentFile()) {
+ // Check 'cur' is project home directory.
+ if (!new File(cur, "bin").isDirectory() ||
+ !new File(cur, "config").isDirectory())
+ continue;
+
+ return cur.getPath();
+ }
+
+ return null;
+ }
+
+ /**
+ * @param cls Class.
+ * @param e Exception.
+ */
+ private static void logResolveFailed(Class cls, Exception e) {
+ warn(null, "Failed to resolve IGNITE_HOME automatically for class
codebase " +
+ "[class=" + cls + (e == null ? "" : ", e=" + e.getMessage()) +
']');
+ }
+
+ /**
+ * @param path Ignite home. May be {@code null}.
+ */
+ public static void setIgniteHome(@Nullable String path) {
+ GridTuple<String> ggHomeTup = ggHome;
+
+ String ggHome0;
+
+ if (ggHomeTup == null) {
+ synchronized (CommonUtils.class) {
+ // Double check.
+ ggHomeTup = ggHome;
+
+ if (ggHomeTup == null) {
+ if (F.isEmpty(path))
+ System.clearProperty(IGNITE_HOME);
+ else
+ System.setProperty(IGNITE_HOME, path);
+
+ ggHome = F.t(path);
+
+ return;
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+ }
+ }
+ else
+ ggHome0 = ggHomeTup.get();
+
+ if (ggHome0 != null && !ggHome0.equals(path)) {
+ try {
+ Path path0 = new File(ggHome0).toPath();
+
+ Path path1 = new File(path).toPath();
+
+ if (!Files.isSameFile(path0, path1))
+ throw new IgniteException("Failed to set IGNITE_HOME after
it has been already resolved " +
+ "[igniteHome=" + path0 + ", newIgniteHome=" + path1 +
']');
+ }
+ catch (IOException ignore) {
+ // Throw an exception if failed to follow symlinks.
+ throw new IgniteException("Failed to set IGNITE_HOME after it
has been already resolved " +
+ "[igniteHome=" + ggHome0 + ", newIgniteHome=" + path +
']');
+ }
+ }
+ }
+
+ /**
+ * Nullifies Ignite home directory. For test purposes only.
+ */
+ public static void nullifyHomeDirectory() {
+ ggHome = null;
+ }
+
+ /**
+ * Indicates whether current OS is Linux flavor.
+ *
+ * @return {@code true} if current OS is Linux - {@code false} otherwise.
+ */
+ public static boolean isLinux() {
+ return linux;
+ }
+
+ /**
+ * Indicates whether current OS is Mac OS.
+ *
+ * @return {@code true} if current OS is Mac OS - {@code false} otherwise.
+ */
+ public static boolean isMacOs() {
+ return mac;
+ }
+
+ /**
+ * Indicates whether current OS is UNIX flavor.
+ *
+ * @return {@code true} if current OS is UNIX - {@code false} otherwise.
+ */
+ public static boolean isUnix() {
+ return unix;
+ }
+
+ /**
+ * Indicates whether current OS is Windows.
+ *
+ * @return {@code true} if current OS is Windows (any versions) - {@code
false} otherwise.
+ */
+ public static boolean isWindows() {
+ return win;
+ }
+
+ /**
+ * Returns URLs of class loader
+ *
+ * @param clsLdr Class loader.
+ */
+ public static URL[] classLoaderUrls(ClassLoader clsLdr) {
+ if (clsLdr == null)
+ return EMPTY_URL_ARR;
+ else if (clsLdr instanceof URLClassLoader)
+ return ((URLClassLoader)clsLdr).getURLs();
+ else if (bltClsLdrCls != null && urlClsLdrField != null &&
bltClsLdrCls.isAssignableFrom(clsLdr.getClass())) {
+ try {
+ synchronized (urlClsLdrField) {
+ // Backup accessible field state.
+ boolean accessible = urlClsLdrField.isAccessible();
+
+ try {
+ if (!accessible)
+ urlClsLdrField.setAccessible(true);
+
+ Object ucp = urlClsLdrField.get(clsLdr);
+
+ if (ucp instanceof URLClassLoader)
+ return ((URLClassLoader)ucp).getURLs();
+ else if (clsURLClassPath != null &&
clsURLClassPath.isInstance(ucp))
+ return (URL[])mthdURLClassPathGetUrls.invoke(ucp);
+ else
+ throw new RuntimeException("Unknown classloader: "
+ clsLdr.getClass());
+ }
+ finally {
+ // Recover accessible field state.
+ if (!accessible)
+ urlClsLdrField.setAccessible(false);
+ }
+ }
+ }
+ catch (InvocationTargetException | IllegalAccessException e) {
+ e.printStackTrace(System.err);
+
+ return EMPTY_URL_ARR;
+ }
+ }
+ else
+ return EMPTY_URL_ARR;
+ }
+
+ /** */
+ @Nullable private static Class defaultClassLoaderClass() {
+ try {
+ return Class.forName("jdk.internal.loader.BuiltinClassLoader");
+ }
+ catch (ClassNotFoundException e) {
+ return null;
+ }
+ }
+
+ /** */
+ @Nullable private static Field urlClassLoaderField() {
+ try {
+ Class cls = defaultClassLoaderClass();
+
+ return cls == null ? null : cls.getDeclaredField("ucp");
+ }
+ catch (NoSuchFieldException e) {
+ return null;
+ }
+ }
+
/**
* Calculate a hashCode for an array.
*
@@ -1623,4 +1999,113 @@ public abstract class CommonUtils {
else
return obj.hashCode();
}
+
+ /**
+ * Gets IgniteClosure for an IgniteCheckedException class.
+ *
+ * @param clazz Class.
+ * @return The IgniteClosure mapped to this exception class, or null if
none.
+ */
+ public static C1<IgniteCheckedException, IgniteException>
getExceptionConverter(Class<? extends IgniteCheckedException> clazz) {
+ return exceptionConverters.get(clazz);
+ }
+
+ /**
+ * @param converters Converters to add.
+ */
+ protected static void addExceptionConverters(
+ Map<Class<? extends IgniteCheckedException>,
C1<IgniteCheckedException, IgniteException>> converters
+ ) {
+ exceptionConverters.putAll(converters);
+ }
+
+ /**
+ * Gets map with converters to convert internal checked exceptions to
public API unchecked exceptions.
+ *
+ * @return Exception converters.
+ */
+ private static Map<Class<? extends IgniteCheckedException>,
C1<IgniteCheckedException, IgniteException>> exceptionConverters() {
+ Map<Class<? extends IgniteCheckedException>,
C1<IgniteCheckedException, IgniteException>> m = new HashMap<>();
+
+ m.put(IgniteInterruptedCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
+ @Override public IgniteException apply(IgniteCheckedException e) {
+ return new IgniteInterruptedException(e.getMessage(),
(InterruptedException)e.getCause());
+ }
+ });
+
+ m.put(IgniteFutureCancelledCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
+ @Override public IgniteException apply(IgniteCheckedException e) {
+ return new IgniteFutureCancelledException(e.getMessage(), e);
+ }
+ });
+
+ m.put(IgniteFutureTimeoutCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
+ @Override public IgniteException apply(IgniteCheckedException e) {
+ return new IgniteFutureTimeoutException(e.getMessage(), e);
+ }
+ });
+
+ m.put(IgniteClientDisconnectedCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
+ @Override public IgniteException apply(IgniteCheckedException e) {
+ return new IgniteClientDisconnectedException(
+
((IgniteClientDisconnectedCheckedException)e).reconnectFuture(),
+ e.getMessage(),
+ e);
+ }
+ });
+
+ return m;
+ }
+
+ /**
+ * Converts exception, but unlike {@link
#convertException(IgniteCheckedException)}
+ * does not wrap passed in exception if none suitable converter found.
+ *
+ * @param e Ignite checked exception.
+ * @return Ignite runtime exception.
+ */
+ public static Exception convertExceptionNoWrap(IgniteCheckedException e) {
+ C1<IgniteCheckedException, IgniteException> converter =
getExceptionConverter(e.getClass());
+
+ if (converter != null)
+ return converter.apply(e);
+
+ if (e.getCause() instanceof IgniteException)
+ return (Exception)e.getCause();
+
+ return e;
+ }
+
+ /**
+ * @param e Ignite checked exception.
+ * @return Ignite runtime exception.
+ */
+ public static IgniteException convertException(IgniteCheckedException e) {
+ IgniteClientDisconnectedException e0 =
e.getCause(IgniteClientDisconnectedException.class);
+
+ if (e0 != null) {
+ assert e0.reconnectFuture() != null : e0;
+
+ throw e0;
+ }
+
+ IgniteClientDisconnectedCheckedException disconnectedErr =
+ e.getCause(IgniteClientDisconnectedCheckedException.class);
+
+ if (disconnectedErr != null) {
+ assert disconnectedErr.reconnectFuture() != null : disconnectedErr;
+
+ e = disconnectedErr;
+ }
+
+ C1<IgniteCheckedException, IgniteException> converter =
getExceptionConverter(e.getClass());
+
+ if (converter != null)
+ return converter.apply(e);
+
+ if (e.getCause() instanceof IgniteException)
+ return (IgniteException)e.getCause();
+
+ return new IgniteException(e.getMessage(), e);
+ }
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteFuture.java
similarity index 100%
rename from modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java
rename to modules/commons/src/main/java/org/apache/ignite/lang/IgniteFuture.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java
b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java
rename to
modules/commons/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java
diff --git
a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java
b/modules/commons/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java
similarity index 100%
rename from
modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java
rename to
modules/commons/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java
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 b759d2f7488..1b013c1ce53 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -175,10 +175,6 @@ public final class IgniteSystemProperties extends
IgniteCommonsSystemProperties
type = Integer.class, defaults = "0")
public static final String IGNITE_RESTART_CODE = "IGNITE_RESTART_CODE";
- /** Defines Ignite installation folder. */
- @SystemProperty(value = "Defines Ignite installation folder", type =
String.class, defaults = "")
- public static final String IGNITE_HOME = "IGNITE_HOME";
-
/** If this system property is set to {@code true} - no shutdown hook will
be set. */
@SystemProperty("If true then no shutdown hook will be set")
public static final String IGNITE_NO_SHUTDOWN_HOOK =
"IGNITE_NO_SHUTDOWN_HOOK";
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index d77bab2caff..6101c0aa2e6 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -68,7 +68,6 @@ import org.apache.ignite.internal.util.CommonUtils;
import org.apache.ignite.internal.util.lang.GridMapEntry;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.marshaller.MarshallerContext;
@@ -476,7 +475,7 @@ public class BinaryContext {
String pkgPath = pkgName.replaceAll("\\.", "/");
- URL[] urls = U.classLoaderUrls(ldr);
+ URL[] urls = CommonUtils.classLoaderUrls(ldr);
for (URL url : urls) {
String proto = url.getProtocol().toLowerCase();
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index 82db49e8383..45700ba57ce 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -33,10 +33,10 @@ import
org.apache.ignite.internal.processors.cache.CacheObjectAdapter;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
+import org.apache.ignite.internal.util.CommonUtils;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.Marshallers;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
@@ -473,7 +473,7 @@ class BinaryEnumObjectImpl implements BinaryObjectEx,
Externalizable, CacheObjec
valBytes = Marshallers.marshal(ctx.marshaller(), this);
}
catch (IgniteCheckedException e) {
- throw U.convertException(e);
+ throw CommonUtils.convertException(e);
}
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
index 9659c837ec1..26592843819 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
@@ -38,7 +38,6 @@ import
org.apache.ignite.internal.binary.streams.BinaryInputStream;
import org.apache.ignite.internal.util.CommonUtils;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.Marshallers;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -2000,7 +1999,7 @@ class BinaryReaderExImpl implements BinaryReaderEx {
throw new BinaryObjectException("Cannot find metadata for
object with compact footer " +
"(Ignite work directory might have been cleared after
restart. Make sure that IGNITE_HOME " +
"does not point to a temp folder or any other folder
that is destroyed/cleared on restarts) [" +
- "typeId=" + typeId + ", IGNITE_HOME='" +
U.getIgniteHome() + "']");
+ "typeId=" + typeId + ", IGNITE_HOME='" +
CommonUtils.getIgniteHome() + "']");
Collection<BinarySchema> existingSchemas = meta.schemas();
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 9b9bd0e01af..93f583cb076 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
@@ -61,10 +61,7 @@ import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.net.URL;
-import java.net.URLClassLoader;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileLock;
@@ -73,7 +70,6 @@ import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.security.ProtectionDomain;
import java.sql.Connection;
import java.sql.SQLException;
import java.time.Instant;
@@ -143,11 +139,9 @@ import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteDeploymentException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteIllegalStateException;
-import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.binary.BinaryIdMapper;
@@ -171,10 +165,7 @@ import
org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteDeploymentCheckedException;
-import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
-import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.binary.BinaryContext;
@@ -203,7 +194,6 @@ import
org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.lang.GridClosureException;
import org.apache.ignite.internal.util.lang.GridPeerDeployAware;
-import org.apache.ignite.internal.util.lang.GridTuple;
import org.apache.ignite.internal.util.lang.IgniteThrowableFunction;
import org.apache.ignite.internal.util.typedef.C1;
import org.apache.ignite.internal.util.typedef.F;
@@ -217,8 +207,6 @@ import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteClosure;
-import org.apache.ignite.lang.IgniteFutureCancelledException;
-import org.apache.ignite.lang.IgniteFutureTimeoutException;
import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteProductVersion;
@@ -337,27 +325,12 @@ public abstract class IgniteUtils extends CommonUtils {
/** Length of numbered file name. */
public static final int NUMBER_FILE_NAME_LENGTH = 16;
- /** Project home directory. */
- private static volatile GridTuple<String> ggHome;
-
/** OS string. */
private static final String osStr;
/** JDK string. */
private static String jdkStr;
- /** Indicates whether current OS is some version of Windows. */
- private static boolean win;
-
- /** Indicates whether current OS is UNIX flavor. */
- private static boolean unix;
-
- /** Indicates whether current OS is Linux flavor. */
- private static boolean linux;
-
- /** Indicates whether current OS is Mac OS. */
- private static boolean mac;
-
/** Name of the JDK. */
private static String jdkName;
@@ -417,10 +390,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());
- /** Exception converters. */
- private static final Map<Class<? extends IgniteCheckedException>,
C1<IgniteCheckedException, IgniteException>>
- exceptionConverters;
-
/** */
private static volatile IgniteBiTuple<Collection<String>,
Collection<String>> cachedLocalAddr;
@@ -451,27 +420,6 @@ public abstract class IgniteUtils extends CommonUtils {
/** */
private static final boolean assertionsEnabled;
- /** Empty URL array. */
- private static final URL[] EMPTY_URL_ARR = new URL[0];
-
- /** Builtin class loader class.
- *
- * Note: needs for compatibility with Java 9.
- */
- private static final Class bltClsLdrCls = defaultClassLoaderClass();
-
- /** Url class loader field.
- *
- * Note: needs for compatibility with Java 9.
- */
- private static final Field urlClsLdrField = urlClassLoaderField();
-
- /** JDK9: jdk.internal.loader.URLClassPath. */
- private static Class clsURLClassPath;
-
- /** JDK9: URLClassPath#getURLs. */
- private static Method mthdURLClassPathGetUrls;
-
/** Byte count prefixes. */
private static final String BYTE_CNT_PREFIXES = " KMGTPE";
@@ -507,27 +455,6 @@ public abstract class IgniteUtils extends CommonUtils {
}
String osName = System.getProperty("os.name");
-
- String osLow = osName.toLowerCase();
-
- // OS type detection.
- if (osLow.contains("win"))
- win = true;
- else if (osLow.contains("mac os"))
- mac = true;
- else {
- // UNIXs flavors tokens.
- for (CharSequence os : new String[] {"ix", "inux", "olaris", "un",
"ux", "sco", "bsd", "att"})
- if (osLow.contains(os)) {
- unix = true;
-
- break;
- }
-
- if (osLow.contains("inux"))
- linux = true;
- }
-
String osArch = System.getProperty("os.arch");
String javaRtName = System.getProperty("java.runtime.name");
@@ -638,7 +565,7 @@ public abstract class IgniteUtils extends CommonUtils {
}
}
- exceptionConverters =
Collections.unmodifiableMap(exceptionConverters());
+ addExceptionConverters(exceptionConverters());
// Set the http.strictPostRedirect property to prevent redirected POST
from being mapped to a GET.
System.setProperty("http.strictPostRedirect", "true");
@@ -651,25 +578,6 @@ public abstract class IgniteUtils extends CommonUtils {
else if ("toString".equals(mtd.getName()))
toStringMtd = mtd;
}
-
- try {
- clsURLClassPath =
Class.forName("jdk.internal.loader.URLClassPath");
- mthdURLClassPathGetUrls = clsURLClassPath.getMethod("getURLs");
- }
- catch (ReflectiveOperationException e) {
- clsURLClassPath = null;
- mthdURLClassPathGetUrls = null;
- }
- }
-
- /**
- * Gets IgniteClosure for an IgniteCheckedException class.
- *
- * @param clazz Class.
- * @return The IgniteClosure mapped to this exception class, or null if
none.
- */
- public static C1<IgniteCheckedException, IgniteException>
getExceptionConverter(Class<? extends IgniteCheckedException> clazz) {
- return exceptionConverters.get(clazz);
}
/**
@@ -681,24 +589,6 @@ public abstract class IgniteUtils extends CommonUtils {
exceptionConverters() {
Map<Class<? extends IgniteCheckedException>,
C1<IgniteCheckedException, IgniteException>> m = new HashMap<>();
- m.put(IgniteInterruptedCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
- @Override public IgniteException apply(IgniteCheckedException e) {
- return new IgniteInterruptedException(e.getMessage(),
(InterruptedException)e.getCause());
- }
- });
-
- m.put(IgniteFutureCancelledCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
- @Override public IgniteException apply(IgniteCheckedException e) {
- return new IgniteFutureCancelledException(e.getMessage(), e);
- }
- });
-
- m.put(IgniteFutureTimeoutCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
- @Override public IgniteException apply(IgniteCheckedException e) {
- return new IgniteFutureTimeoutException(e.getMessage(), e);
- }
- });
-
m.put(ClusterGroupEmptyCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
@Override public IgniteException apply(IgniteCheckedException e) {
return new ClusterGroupEmptyException(e.getMessage(), e);
@@ -763,15 +653,6 @@ public abstract class IgniteUtils extends CommonUtils {
}
});
- m.put(IgniteClientDisconnectedCheckedException.class, new
C1<IgniteCheckedException, IgniteException>() {
- @Override public IgniteException apply(IgniteCheckedException e) {
- return new IgniteClientDisconnectedException(
-
((IgniteClientDisconnectedCheckedException)e).reconnectFuture(),
- e.getMessage(),
- e);
- }
- });
-
return m;
}
@@ -806,58 +687,6 @@ public abstract class IgniteUtils extends CommonUtils {
Collections.emptyList();
}
- /**
- * Converts exception, but unlike {@link
#convertException(IgniteCheckedException)}
- * does not wrap passed in exception if none suitable converter found.
- *
- * @param e Ignite checked exception.
- * @return Ignite runtime exception.
- */
- public static Exception convertExceptionNoWrap(IgniteCheckedException e) {
- C1<IgniteCheckedException, IgniteException> converter =
exceptionConverters.get(e.getClass());
-
- if (converter != null)
- return converter.apply(e);
-
- if (e.getCause() instanceof IgniteException)
- return (Exception)e.getCause();
-
- return e;
- }
-
- /**
- * @param e Ignite checked exception.
- * @return Ignite runtime exception.
- */
- public static IgniteException convertException(IgniteCheckedException e) {
- IgniteClientDisconnectedException e0 =
e.getCause(IgniteClientDisconnectedException.class);
-
- if (e0 != null) {
- assert e0.reconnectFuture() != null : e0;
-
- throw e0;
- }
-
- IgniteClientDisconnectedCheckedException disconnectedErr =
- e.getCause(IgniteClientDisconnectedCheckedException.class);
-
- if (disconnectedErr != null) {
- assert disconnectedErr.reconnectFuture() != null : disconnectedErr;
-
- e = disconnectedErr;
- }
-
- C1<IgniteCheckedException, IgniteException> converter =
exceptionConverters.get(e.getClass());
-
- if (converter != null)
- return converter.apply(e);
-
- if (e.getCause() instanceof IgniteException)
- return (IgniteException)e.getCause();
-
- return new IgniteException(e.getMessage(), e);
- }
-
/**
* Gets name for given grid event type.
*
@@ -2775,179 +2604,6 @@ public abstract class IgniteUtils extends CommonUtils {
return dir.mkdirs() || dir.exists();
}
- /**
- * Resolve project home directory based on source code base.
- *
- * @return Project home directory (or {@code null} if it cannot be
resolved).
- */
- @Nullable private static String resolveProjectHome() {
- assert Thread.holdsLock(IgniteUtils.class);
-
- // Resolve Ignite home via environment variables.
- String ggHome0 = IgniteSystemProperties.getString(IGNITE_HOME);
-
- if (!F.isEmpty(ggHome0))
- return ggHome0;
-
- String appWorkDir = System.getProperty("user.dir");
-
- if (appWorkDir != null) {
- ggHome0 = findProjectHome(new File(appWorkDir));
-
- if (ggHome0 != null)
- return ggHome0;
- }
-
- URI classesUri;
-
- Class<IgniteUtils> cls = IgniteUtils.class;
-
- try {
- ProtectionDomain domain = cls.getProtectionDomain();
-
- // Should not happen, but to make sure our code is not broken.
- if (domain == null || domain.getCodeSource() == null ||
domain.getCodeSource().getLocation() == null) {
- logResolveFailed(cls, null);
-
- return null;
- }
-
- // Resolve path to class-file.
- classesUri = domain.getCodeSource().getLocation().toURI();
-
- // Overcome UNC path problem on Windows
(http://www.tomergabel.com/JavaMishandlesUNCPathsOnWindows.aspx)
- if (isWindows() && classesUri.getAuthority() != null)
- classesUri = new URI(classesUri.toString().replace("file://",
"file:/"));
- }
- catch (URISyntaxException | SecurityException e) {
- logResolveFailed(cls, e);
-
- return null;
- }
-
- File classesFile;
-
- try {
- classesFile = new File(classesUri);
- }
- catch (IllegalArgumentException e) {
- logResolveFailed(cls, e);
-
- return null;
- }
-
- return findProjectHome(classesFile);
- }
-
- /**
- * Tries to find project home starting from specified directory and moving
to root.
- *
- * @param startDir First directory in search hierarchy.
- * @return Project home path or {@code null} if it wasn't found.
- */
- private static String findProjectHome(File startDir) {
- for (File cur = startDir.getAbsoluteFile(); cur != null; cur =
cur.getParentFile()) {
- // Check 'cur' is project home directory.
- if (!new File(cur, "bin").isDirectory() ||
- !new File(cur, "config").isDirectory())
- continue;
-
- return cur.getPath();
- }
-
- return null;
- }
-
- /**
- * @param cls Class.
- * @param e Exception.
- */
- private static void logResolveFailed(Class cls, Exception e) {
- warn(null, "Failed to resolve IGNITE_HOME automatically for class
codebase " +
- "[class=" + cls + (e == null ? "" : ", e=" + e.getMessage()) +
']');
- }
-
- /**
- * Retrieves {@code IGNITE_HOME} property. The property is retrieved from
system
- * properties or from environment in that order.
- *
- * @return {@code IGNITE_HOME} property.
- */
- @Nullable public static String getIgniteHome() {
- GridTuple<String> ggHomeTup = ggHome;
-
- String ggHome0;
-
- if (ggHomeTup == null) {
- synchronized (IgniteUtils.class) {
- // Double check.
- ggHomeTup = ggHome;
-
- if (ggHomeTup == null) {
- // Resolve Ignite installation home directory.
- ggHome = F.t(ggHome0 = resolveProjectHome());
-
- if (ggHome0 != null)
- System.setProperty(IGNITE_HOME, ggHome0);
- }
- else
- ggHome0 = ggHomeTup.get();
- }
- }
- else
- ggHome0 = ggHomeTup.get();
-
- return ggHome0;
- }
-
- /**
- * @param path Ignite home. May be {@code null}.
- */
- public static void setIgniteHome(@Nullable String path) {
- GridTuple<String> ggHomeTup = ggHome;
-
- String ggHome0;
-
- if (ggHomeTup == null) {
- synchronized (IgniteUtils.class) {
- // Double check.
- ggHomeTup = ggHome;
-
- if (ggHomeTup == null) {
- if (F.isEmpty(path))
- System.clearProperty(IGNITE_HOME);
- else
- System.setProperty(IGNITE_HOME, path);
-
- ggHome = F.t(path);
-
- return;
- }
- else
- ggHome0 = ggHomeTup.get();
- }
- }
- else
- ggHome0 = ggHomeTup.get();
-
- if (ggHome0 != null && !ggHome0.equals(path)) {
- try {
- Path path0 = new File(ggHome0).toPath();
-
- Path path1 = new File(path).toPath();
-
- if (!Files.isSameFile(path0, path1))
- throw new IgniteException("Failed to set IGNITE_HOME after
it has been already resolved " +
- "[igniteHome=" + path0 + ", newIgniteHome=" + path1 +
']');
- }
- catch (IOException ignore) {
- // Throw an exception if failed to follow symlinks.
- throw new IgniteException("Failed to set IGNITE_HOME after it
has been already resolved " +
- "[igniteHome=" + ggHome0 + ", newIgniteHome=" + path +
']');
- }
- }
- }
-
/**
* Gets file associated with path.
* <p>
@@ -4889,42 +4545,6 @@ public abstract class IgniteUtils extends CommonUtils {
return jdkStr;
}
- /**
- * Indicates whether current OS is Linux flavor.
- *
- * @return {@code true} if current OS is Linux - {@code false} otherwise.
- */
- public static boolean isLinux() {
- return linux;
- }
-
- /**
- * Indicates whether current OS is Mac OS.
- *
- * @return {@code true} if current OS is Mac OS - {@code false} otherwise.
- */
- public static boolean isMacOs() {
- return mac;
- }
-
- /**
- * Indicates whether current OS is UNIX flavor.
- *
- * @return {@code true} if current OS is UNIX - {@code false} otherwise.
- */
- public static boolean isUnix() {
- return unix;
- }
-
- /**
- * Indicates whether current OS is Windows.
- *
- * @return {@code true} if current OS is Windows (any versions) - {@code
false} otherwise.
- */
- public static boolean isWindows() {
- return win;
- }
-
/**
* Gets JVM implementation name.
*
@@ -5623,74 +5243,6 @@ public abstract class IgniteUtils extends CommonUtils {
Thread.currentThread().interrupt();
}
- /**
- * Returns URLs of class loader
- *
- * @param clsLdr Class loader.
- */
- public static URL[] classLoaderUrls(ClassLoader clsLdr) {
- if (clsLdr == null)
- return EMPTY_URL_ARR;
- else if (clsLdr instanceof URLClassLoader)
- return ((URLClassLoader)clsLdr).getURLs();
- else if (bltClsLdrCls != null && urlClsLdrField != null &&
bltClsLdrCls.isAssignableFrom(clsLdr.getClass())) {
- try {
- synchronized (urlClsLdrField) {
- // Backup accessible field state.
- boolean accessible = urlClsLdrField.isAccessible();
-
- try {
- if (!accessible)
- urlClsLdrField.setAccessible(true);
-
- Object ucp = urlClsLdrField.get(clsLdr);
-
- if (ucp instanceof URLClassLoader)
- return ((URLClassLoader)ucp).getURLs();
- else if (clsURLClassPath != null &&
clsURLClassPath.isInstance(ucp))
- return (URL[])mthdURLClassPathGetUrls.invoke(ucp);
- else
- throw new RuntimeException("Unknown classloader: "
+ clsLdr.getClass());
- }
- finally {
- // Recover accessible field state.
- if (!accessible)
- urlClsLdrField.setAccessible(false);
- }
- }
- }
- catch (InvocationTargetException | IllegalAccessException e) {
- e.printStackTrace(System.err);
-
- return EMPTY_URL_ARR;
- }
- }
- else
- return EMPTY_URL_ARR;
- }
-
- /** */
- @Nullable private static Class defaultClassLoaderClass() {
- try {
- return Class.forName("jdk.internal.loader.BuiltinClassLoader");
- }
- catch (ClassNotFoundException e) {
- return null;
- }
- }
-
- /** */
- @Nullable private static Field urlClassLoaderField() {
- try {
- Class cls = defaultClassLoaderClass();
-
- return cls == null ? null : cls.getDeclaredField("ucp");
- }
- catch (NoSuchFieldException e) {
- return null;
- }
- }
-
/**
* Sleeps for given number of milliseconds.
*
@@ -6752,13 +6304,6 @@ public abstract class IgniteUtils extends CommonUtils {
return workDir.getAbsolutePath();
}
- /**
- * Nullifies Ignite home directory. For test purposes only.
- */
- public static void nullifyHomeDirectory() {
- ggHome = null;
- }
-
/**
* Resolves work directory.
*