本文整理汇总了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);
}
}
示例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);
}
}
示例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();
}