nizhikov commented on code in PR #12266:
URL: https://github.com/apache/ignite/pull/12266#discussion_r2273698061


##########
modules/commons/src/main/java/org/apache/ignite/internal/util/CommonUtils.java:
##########
@@ -455,4 +491,253 @@ public static void writeUuid(DataOutput out, UUID uid) 
throws IOException {
 
         return null;
     }
+
+    /**
+     * Get current Ignite name.
+     *
+     * @return Current Ignite name.
+     */
+    @Nullable public static String getCurrentIgniteName() {
+        return LOC_IGNITE_NAME.get();
+    }
+
+    /**
+     * Check if current Ignite name is set.
+     *
+     * @param name Name to check.
+     * @return {@code True} if set.
+     */
+    @SuppressWarnings("StringEquality")
+    public static boolean isCurrentIgniteNameSet(@Nullable String name) {
+        return name != LOC_IGNITE_NAME_EMPTY;
+    }
+
+    /**
+     * Set current Ignite name.
+     *
+     * @param newName New name.
+     * @return Old name.
+     */
+    @SuppressWarnings("StringEquality")
+    @Nullable public static String setCurrentIgniteName(@Nullable String 
newName) {
+        String oldName = LOC_IGNITE_NAME.get();
+
+        if (oldName != newName)
+            LOC_IGNITE_NAME.set(newName);
+
+        return oldName;
+    }
+
+    /**
+     * Restore old Ignite name.
+     *
+     * @param oldName Old name.
+     * @param curName Current name.
+     */
+    @SuppressWarnings("StringEquality")
+    public static void restoreOldIgniteName(@Nullable String oldName, 
@Nullable String curName) {
+        if (oldName != curName)
+            LOC_IGNITE_NAME.set(oldName);
+    }
+
+    /**
+     * @return Class loader used to load Ignite itself.
+     */
+    public static ClassLoader gridClassLoader() {
+        return gridClassLoader;
+    }
+
+    /**
+     * @param ldr Custom class loader.
+     * @param cfgLdr Class loader from config.
+     * @return ClassLoader passed as param in case it is not null or cfgLdr  
in case it is not null or ClassLoader used to start Ignite.
+     */
+    public static ClassLoader resolveClassLoader(@Nullable ClassLoader ldr, 
@Nullable ClassLoader cfgLdr) {
+        return (ldr != null && ldr != gridClassLoader)
+            ? ldr
+            : cfgLdr != null
+                ? cfgLdr
+                : gridClassLoader;
+    }
+
+    /**
+     * Tests whether or not given class is loadable provided class loader.

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to