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


Java ClassLoaderUtil类代码示例

本文整理汇总了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);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:EjbProcessApplication.java

示例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;
      }
    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:ProcessApplicationContextUtil.java

示例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();

  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:MscRuntimeContainerDelegate.java

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

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

示例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();
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:ProcessApplicationClassloaderInterceptor.java

示例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;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:10,代码来源:AbstractParseBpmPlatformXmlStep.java

示例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;
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:DiscoverBpmPlatformPluginsStep.java

示例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);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:7,代码来源:SpinProcessEnginePlugin.java

示例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());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:6,代码来源:AbstractProcessApplication.java

示例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());

    }

  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:ServletProcessApplication.java


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