本文整理汇总了Java中org.camunda.bpm.engine.impl.util.ClassLoaderUtil类的典型用法代码示例。如果您正苦于以下问题:Java ClassLoaderUtil类的具体用法?Java ClassLoaderUtil怎么用?Java ClassLoaderUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassLoaderUtil类属于org.camunda.bpm.engine.impl.util包,在下文中一共展示了ClassLoaderUtil类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
public <T> T execute(Callable<T> callable) throws ProcessApplicationExecutionException {
ClassLoader originalClassloader = ClassLoaderUtil.getContextClassloader();
ClassLoader processApplicationClassloader = getProcessApplicationClassloader();
try {
if (originalClassloader != processApplicationClassloader) {
ClassLoaderUtil.setContextClassloader(processApplicationClassloader);
}
return callable.call();
}
catch(Exception e) {
throw LOG.processApplicationExecutionException(e);
}
finally {
ClassLoaderUtil.setContextClassloader(originalClassloader);
}
}
示例2: requiresContextSwitch
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
public static boolean requiresContextSwitch(ProcessApplicationReference processApplicationReference) {
final ProcessApplicationReference currentProcessApplication = Context.getCurrentProcessApplication();
if(processApplicationReference == null) {
return false;
}
if(currentProcessApplication == null) {
return true;
}
else {
if(!processApplicationReference.getName().equals(currentProcessApplication.getName())) {
return true;
}
else {
// check whether the thread context has been manipulated since last context switch. This can happen as a result of
// an operation causing the container to switch to a different application.
// Example: JavaDelegate implementation (inside PA) invokes an EJB from different application which in turn interacts with the Process engine.
ClassLoader processApplicationClassLoader = ProcessApplicationClassloaderInterceptor.getProcessApplicationClassLoader();
ClassLoader currentClassloader = ClassLoaderUtil.getContextClassloader();
return currentClassloader != processApplicationClassLoader;
}
}
}
示例3: deployServletProcessApplication
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void deployServletProcessApplication(ServletProcessApplication processApplication) {
ClassLoader contextClassloader = ClassLoaderUtil.getContextClassloader();
String moduleName = ((ModuleClassLoader)contextClassloader).getModule().getIdentifier().toString();
ServiceName serviceName = ServiceNames.forNoViewProcessApplicationStartService(moduleName);
ServiceName paModuleService = ServiceNames.forProcessApplicationModuleService(moduleName);
if(serviceContainer.getService(serviceName) == null) {
ServiceController<ServiceTarget> requiredService = (ServiceController<ServiceTarget>) serviceContainer.getRequiredService(paModuleService);
NoViewProcessApplicationStartService service = new NoViewProcessApplicationStartService(processApplication.getReference());
requiredService.getValue()
.addService(serviceName, service)
.setInitialMode(Mode.ACTIVE)
.install();
}
}
示例4: preInit
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
@Override
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
// use classloader which loaded the plugin
ClassLoader classloader = ClassLoaderUtil.getClassloader(ConnectProcessEnginePlugin.class);
Connectors.loadConnectors(classloader);
addConnectorParseListener(processEngineConfiguration);
}
示例5: execute
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
public <T> T execute(Callable<T> callable) throws ProcessApplicationExecutionException {
ClassLoader originalClassloader = ClassLoaderUtil.getContextClassloader();
ClassLoader processApplicationClassloader = getProcessApplicationClassloader();
try {
ClassLoaderUtil.setContextClassloader(processApplicationClassloader);
return callable.call();
} catch (Exception e) {
throw LOG.processApplicationExecutionException(e);
} finally {
ClassLoaderUtil.setContextClassloader(originalClassloader);
}
}
示例6: call
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
public T call() throws Exception {
try {
// record thread context right after context switch
PA_CLASSLOADER.set(ClassLoaderUtil.getContextClassloader());
// proceed with delegate callable invocation
return delegate.call();
}
finally {
PA_CLASSLOADER.remove();
}
}
示例7: lookupBpmPlatformXmlFromClassPath
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
public URL lookupBpmPlatformXmlFromClassPath(String resourceLocation) {
URL fileLocation = ClassLoaderUtil.getClassloader(getClass()).getResource(resourceLocation);
if (fileLocation != null) {
LOG.foundConfigAtLocation(resourceLocation, fileLocation.toString());
}
return fileLocation;
}
示例8: getPluginsClassloader
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
protected ClassLoader getPluginsClassloader() {
ClassLoader pluginsClassLoader = ClassLoaderUtil.getContextClassloader();
if(pluginsClassLoader == null) {
// if context classloader is null, use classloader which loaded the camunda-engine jar.
pluginsClassLoader = BpmPlatform.class.getClassLoader();
}
return pluginsClassLoader;
}
示例9: preInit
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
@Override
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
// use classloader which loaded the plugin
ClassLoader classloader = ClassLoaderUtil.getClassloader(SpinProcessEnginePlugin.class);
DataFormats.loadDataFormats(classloader);
}
示例10: getProcessApplicationClassloader
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
public ClassLoader getProcessApplicationClassloader() {
// the default implementation uses the classloader that loaded
// the application-provided subclass of this class.
return ClassLoaderUtil.getClassloader(getClass());
}
示例11: initProcessApplicationClassloader
import org.camunda.bpm.engine.impl.util.ClassLoaderUtil; //导入依赖的package包/类
protected ClassLoader initProcessApplicationClassloader(ServletContextEvent sce) {
if (isServlet30ApiPresent(sce) && getClass().equals(ServletProcessApplication.class)) {
return ClassLoaderUtil.getServletContextClassloader(sce);
} else {
return ClassLoaderUtil.getClassloader(getClass());
}
}