本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.gridClassLoader方法的典型用法代码示例。如果您正苦于以下问题:Java U.gridClassLoader方法的具体用法?Java U.gridClassLoader怎么用?Java U.gridClassLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.gridClassLoader方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GridDeploymentManager
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param ctx Grid kernal context.
*/
public GridDeploymentManager(GridKernalContext ctx) {
super(ctx, ctx.config().getDeploymentSpi());
if (!ctx.config().isPeerClassLoadingEnabled()) {
DeploymentSpi spi = ctx.config().getDeploymentSpi();
IgnoreIfPeerClassLoadingDisabled ann = U.getAnnotation(spi.getClass(),
IgnoreIfPeerClassLoadingDisabled.class);
locDep = ann != null ?
new LocalDeployment(
ctx.config().getDeploymentMode(),
ctx.config().getClassLoader() != null ? ctx.config().getClassLoader() : U.gridClassLoader(),
IgniteUuid.fromUuid(ctx.localNodeId()),
ctx.userVersion(U.gridClassLoader()),
String.class.getName()) :
null;
}
else
locDep = null;
}
示例2: detectClassLoader
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Detects class loader for given class.
* <p>
* This method will first check if {@link Thread#getContextClassLoader()} is appropriate.
* If yes, then context class loader will be returned, otherwise
* the {@link Class#getClassLoader()} will be returned.
*
* @param cls Class to find class loader for.
* @return Class loader for given class (never {@code null}).
*/
private static ClassLoader detectClassLoader(Class<?> cls) {
ClassLoader ctxClsLdr = Thread.currentThread().getContextClassLoader();
ClassLoader clsLdr = cls.getClassLoader();
if (clsLdr == null)
clsLdr = U.gridClassLoader();
if (U.p2pLoader(ctxClsLdr))
return clsLdr;
if (ctxClsLdr != null) {
if (ctxClsLdr == clsLdr)
return ctxClsLdr;
try {
// Check if context loader is wider than direct object class loader.
Class<?> c = Class.forName(cls.getName(), true, ctxClsLdr);
if (c == cls)
return ctxClsLdr;
}
catch (ClassNotFoundException ignored) {
// No-op.
}
}
return clsLdr;
}
示例3: getExternalClassLoader
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Gets external class loader.
*
* @return External class loader.
*/
protected static ClassLoader getExternalClassLoader() {
String path = GridTestProperties.getProperty("p2p.uri.cls");
try {
return new URLClassLoader(new URL[] {new URL(path)}, U.gridClassLoader());
}
catch (MalformedURLException e) {
throw new RuntimeException("Failed to create URL: " + path, e);
}
}
示例4: MarshallerContextImpl
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Initializes context.
*
* @param plugins Plugins.
*/
public MarshallerContextImpl(@Nullable Collection<PluginProvider> plugins) {
initializeCaches();
try {
ClassLoader ldr = U.gridClassLoader();
Enumeration<URL> urls = ldr.getResources(CLS_NAMES_FILE);
boolean foundClsNames = false;
while (urls.hasMoreElements()) {
processResource(urls.nextElement());
foundClsNames = true;
}
if (!foundClsNames)
throw new IgniteException("Failed to load class names properties file packaged with ignite binaries " +
"[file=" + CLS_NAMES_FILE + ", ldr=" + ldr + ']');
URL jdkClsNames = ldr.getResource(JDK_CLS_NAMES_FILE);
if (jdkClsNames == null)
throw new IgniteException("Failed to load class names properties file packaged with ignite binaries " +
"[file=" + JDK_CLS_NAMES_FILE + ", ldr=" + ldr + ']');
processResource(jdkClsNames);
checkHasClassName(GridDhtPartitionFullMap.class.getName(), ldr, CLS_NAMES_FILE);
checkHasClassName(GridDhtPartitionMap.class.getName(), ldr, CLS_NAMES_FILE);
checkHasClassName(HashMap.class.getName(), ldr, JDK_CLS_NAMES_FILE);
if (plugins != null && !plugins.isEmpty()) {
for (PluginProvider plugin : plugins) {
Enumeration<URL> pluginUrls = ldr.getResources("META-INF/" + plugin.name().toLowerCase()
+ ".classnames.properties");
while (pluginUrls.hasMoreElements())
processResource(pluginUrls.nextElement());
}
}
}
catch (IOException e) {
throw new IllegalStateException("Failed to initialize marshaller context.", e);
}
}
示例5: localLoader
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return Local-only class loader.
*/
public ClassLoader localLoader() {
GridDeployment dep = locDep.get();
return dep == null ? U.gridClassLoader() : dep.classLoader();
}