本文整理匯總了Java中org.kuali.rice.core.api.util.ContextClassLoaderBinder.doInContextClassLoader方法的典型用法代碼示例。如果您正苦於以下問題:Java ContextClassLoaderBinder.doInContextClassLoader方法的具體用法?Java ContextClassLoaderBinder.doInContextClassLoader怎麽用?Java ContextClassLoaderBinder.doInContextClassLoader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kuali.rice.core.api.util.ContextClassLoaderBinder
的用法示例。
在下文中一共展示了ContextClassLoaderBinder.doInContextClassLoader方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: stop
import org.kuali.rice.core.api.util.ContextClassLoaderBinder; //導入方法依賴的package包/類
/**
* Stops the plugin.
*/
public synchronized void stop() {
if (!started) {
LOG.info(getLogPrefix()+" has already been stopped.");
return;
}
LOG.info(getLogPrefix()+" Stopping...");
try {
ContextClassLoaderBinder.doInContextClassLoader(getClassLoader(), new Callable() {
@Override
public Object call() throws Exception {
started = false;
stopPluginListeners();
// stop resource loaders of super class
Plugin.super.stop();
return null;
}
});
} catch (Throwable t) {
LOG.error(getLogPrefix()+" Failed when attempting to stop the plugin.", t);
}
resetPlugin();
LOG.info(getLogPrefix()+" ...stopped.");
}
示例2: testIsOjbLoadedClass_NoOjbOnClasspath
import org.kuali.rice.core.api.util.ContextClassLoaderBinder; //導入方法依賴的package包/類
/**
* Ensures false is returned form isOjbLoadedClass if OJB is not on the classpath.
*/
@Test
public void testIsOjbLoadedClass_NoOjbOnClasspath() throws Exception {
// set an empty classloader to cause the check to load OJB MetadataManager to fail from inside isOjbLoadedClass
ContextClassLoaderBinder.doInContextClassLoader(ClassLoader.getSystemClassLoader().getParent(),
new Callable<Object>() {
@Override
public Object call() throws Exception {
assertFalse(detector.isOjbLoadedClass(DummyDataObjectOjb.class));
return null;
}
});
}
示例3: start
import org.kuali.rice.core.api.util.ContextClassLoaderBinder; //導入方法依賴的package包/類
/**
* Starts the plugin.
*/
public synchronized void start() {
if (started) {
LOG.info(getLogPrefix()+" has already been started.");
return;
}
LOG.info(getLogPrefix()+" Starting...");
try {
ContextClassLoaderBinder.doInContextClassLoader(getClassLoader(), new Callable() {
@Override
public Object call() throws Exception {
startupFailure = false;
started = true;
Plugin.super.start();
LOG.info("Starting plugin listeners");
startPluginListeners();
return null;
}
});
ClassLoader classLoader = getClassLoader();
LOG.info(getLogPrefix()+" ...started." + (classLoader != null ? classLoader.toString() : ""));
} catch (Throwable t) {
LOG.error(getLogPrefix()+" Failure starting plugin.", t);
startupFailure = true;
started = true;
stop();
if (!suppressStartupFailure) {
if (t instanceof Error) {
throw (Error)t;
} else if (t instanceof RuntimeException) {
throw (RuntimeException)t;
}
throw new WorkflowRuntimeException("Failed to startup plugin.", t);
}
}
}
示例4: load
import org.kuali.rice.core.api.util.ContextClassLoaderBinder; //導入方法依賴的package包/類
/**
* Loads and creates the Plugin.
*/
public Plugin load() throws Exception {
final PluginClassLoader classLoader = createPluginClassLoader();
LOG.info("Created plugin ClassLoader: " + classLoader);
return ContextClassLoaderBinder.doInContextClassLoader(classLoader, new Callable<Plugin>() {
public Plugin call() throws IOException {
return loadWithinContextClassLoader(classLoader);
}
});
}