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


Java VMStackWalker.firstNonNullClassLoader方法代码示例

本文整理汇总了Java中gnu.classpath.VMStackWalker.firstNonNullClassLoader方法的典型用法代码示例。如果您正苦于以下问题:Java VMStackWalker.firstNonNullClassLoader方法的具体用法?Java VMStackWalker.firstNonNullClassLoader怎么用?Java VMStackWalker.firstNonNullClassLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.classpath.VMStackWalker的用法示例。


在下文中一共展示了VMStackWalker.firstNonNullClassLoader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadClass

import gnu.classpath.VMStackWalker; //导入方法依赖的package包/类
/**
 * Load the class. The method uses class loaders from the call stact first. If
 * this fails, the further behaviour depends on the System Property
 * "java.rmi.server.useCodebaseOnly" with default value "false".
 *
 * <ul>
 * <li>Try the current thread context class loader first.</li>
 * <li>If remoteCodebase is non-null and useCodebaseOnly is "false" then call
 * java.rmi.server.RMIClassLoader.loadClass (remoteCodebase, className)</li>
 * <li> If remoteCodebase is null or useCodebaseOnly is true then call
 * java.rmi.server.RMIClassLoader.loadClass(className)</li>
 * <li>If a class is still not successfully loaded and the loader != null
 * then try Class.forName(className, false, loader). </li>
 * </ul>
 *
 * @param className the name of the class.
 * @param remoteCodebase the codebase.
 * @param loader the class loader.
 * @return the loaded class.
 *
 * @throws ClassNotFoundException of the class cannot be loaded.
 */
public Class loadClass(String className, String remoteCodebase,
  ClassLoader loader)
  throws ClassNotFoundException
{
  if (loader == null)
    loader = VMStackWalker.firstNonNullClassLoader();

  String p_useCodebaseOnly = System.getProperty("java.rmi.server.useCodebaseOnly");

  boolean useCodebaseOnly = p_useCodebaseOnly != null
    && p_useCodebaseOnly.trim().equalsIgnoreCase("true");

  if (useCodebaseOnly)
    remoteCodebase = null;

  try
    {
      return RMIClassLoader.loadClass(remoteCodebase, className, loader);
    }
  catch (MalformedURLException x)
    {
      throw new ClassNotFoundException(className, x);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:47,代码来源:UtilDelegateImpl.java

示例2: loadClass

import gnu.classpath.VMStackWalker; //导入方法依赖的package包/类
/**
 * Load the class. The method uses class loaders from the call stact first. If
 * this fails, the further behaviour depends on the System Property
 * "java.rmi.server.useCodebaseOnly" with default value "false".
 * 
 * <ul>
 * <li>Try the current thread context class loader first.</li>
 * <li>If remoteCodebase is non-null and useCodebaseOnly is "false" then call
 * java.rmi.server.RMIClassLoader.loadClass (remoteCodebase, className)</li>
 * <li> If remoteCodebase is null or useCodebaseOnly is true then call
 * java.rmi.server.RMIClassLoader.loadClass(className)</li>
 * <li>If a class is still not successfully loaded and the loader != null
 * then try Class.forName(className, false, loader). </li>
 * </ul>
 * 
 * @param className the name of the class.
 * @param remoteCodebase the codebase.
 * @param loader the class loader.
 * @return the loaded class.
 * 
 * @throws ClassNotFoundException of the class cannot be loaded.
 */
public Class loadClass(String className, String remoteCodebase,
  ClassLoader loader)
  throws ClassNotFoundException
{
  if (loader == null)
    loader = VMStackWalker.firstNonNullClassLoader();

  String p_useCodebaseOnly = System.getProperty("java.rmi.server.useCodebaseOnly");

  boolean useCodebaseOnly = p_useCodebaseOnly != null
    && p_useCodebaseOnly.trim().equalsIgnoreCase("true");

  if (useCodebaseOnly)
    remoteCodebase = null;

  try
    {
      return RMIClassLoader.loadClass(remoteCodebase, className, loader);
    }
  catch (MalformedURLException x)
    {
      throw new ClassNotFoundException(className, x);
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:47,代码来源:UtilDelegateImpl.java

示例3: currentLoader

import gnu.classpath.VMStackWalker; //导入方法依赖的package包/类
/**
 * Returns the most recent user defined ClassLoader on the execution stack
 * or null if none is found.
 */
private ClassLoader currentLoader()
{
  return VMStackWalker.firstNonNullClassLoader();
}
 
开发者ID:vilie,项目名称:javify,代码行数:9,代码来源:ObjectInputStream.java


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