@Override public ClassLoader classLoader() { if (ldr == null) ldr = detectClassLoader(cls); return ldr; } };
/** * Detects class loader for given object's class. * * @param obj Object to find class loader for class of. * @return Class loader for given object (possibly {@code null}). */ @Nullable public static ClassLoader detectObjectClassLoader(@Nullable Object obj) { if (obj == null) return null; if (obj instanceof GridPeerDeployAware) return ((GridPeerDeployAware)obj).classLoader(); return detectClassLoader(obj.getClass()); }
/** * Check if all elements from the collection could be loaded with the same classloader as the given object. * * @param obj base object. * @param c collection to check elements from. * @return {@code true} if all elements could be loaded with {@code obj}'s classloader, {@code false} otherwise */ private static boolean hasCommonClassLoader(Object obj, Iterable<?> c) { assert obj != null; assert c != null; ClassLoader ldr = obj instanceof GridPeerDeployAware ? ((GridPeerDeployAware)obj).classLoader() : detectClassLoader(obj.getClass()); boolean found = true; for (Object obj2 : c) { if (obj2 == null || obj2 == obj) continue; // Obj2 class name. String clsName = obj2 instanceof GridPeerDeployAware ? ((GridPeerDeployAware)obj2).deployClass().getName() : obj2.getClass().getName(); if (!isLoadableBy(clsName, ldr)) { found = false; break; } } return found; }
IgniteUtils.detectClassLoader(IgniteUtils.detectClass(this.val)) : U.gridClassLoader();
@Override public ClassLoader classLoader() { if (ldr == null) ldr = detectClassLoader(cls); return ldr; } };
/** * Detects class loader for given object's class. * * @param obj Object to find class loader for class of. * @return Class loader for given object (possibly {@code null}). */ @Nullable public static ClassLoader detectObjectClassLoader(@Nullable Object obj) { if (obj == null) return null; if (obj instanceof GridPeerDeployAware) return ((GridPeerDeployAware)obj).classLoader(); return detectClassLoader(obj.getClass()); }
/** * Check if all elements from the collection could be loaded with the same classloader as the given object. * * @param obj base object. * @param c collection to check elements from. * @return {@code true} if all elements could be loaded with {@code obj}'s classloader, {@code false} otherwise */ private static boolean hasCommonClassLoader(Object obj, Iterable<?> c) { assert obj != null; assert c != null; ClassLoader ldr = obj instanceof GridPeerDeployAware ? ((GridPeerDeployAware)obj).classLoader() : detectClassLoader(obj.getClass()); boolean found = true; for (Object obj2 : c) { if (obj2 == null || obj2 == obj) continue; // Obj2 class name. String clsName = obj2 instanceof GridPeerDeployAware ? ((GridPeerDeployAware)obj2).deployClass().getName() : obj2.getClass().getName(); if (!isLoadableBy(clsName, ldr)) { found = false; break; } } return found; }
IgniteUtils.detectClassLoader(IgniteUtils.detectClass(this.val)) : U.gridClassLoader();