当前位置: 首页>>代码示例>>Java>>正文


Java U.gridClassLoader方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridDeploymentManager.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:40,代码来源:GridClassLoaderCache.java

示例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);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:GridAbstractTest.java

示例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);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:52,代码来源:MarshallerContextImpl.java

示例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();
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridCacheDeploymentManager.java


注:本文中的org.apache.ignite.internal.util.typedef.internal.U.gridClassLoader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。