本文整理了Java中org.xwiki.context.Execution.removeContext()
方法的一些代码示例,展示了Execution.removeContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execution.removeContext()
方法的具体详情如下:
包路径:org.xwiki.context.Execution
类名称:Execution
方法名:removeContext
[英]Remove all context levels for the current thread.
[中]删除当前线程的所有上下文级别。
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
protected void cleanupExecutionContext()
{
Execution ech = Utils.getComponent(Execution.class);
// We must ensure we clean the ThreadLocal variables located in the Execution
// component as otherwise we will have a potential memory leak.
ech.removeContext();
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-tests
public void shutdown() throws Exception
{
Execution execution = getComponentManager().lookup(Execution.class);
execution.removeContext();
// Make sure we mark the component manager for garbage collection as otherwise each JUnit test will
// have an instance of the Component Manager (will all the components it's holding), leading to
// out of memory errors when there are lots of tests...
this.componentManager = null;
}
代码示例来源:origin: com.xpn.xwiki.platform.tools/xwiki-shared-tests
public void shutdown() throws Exception
{
Execution execution = (Execution) getComponentManager().lookup(Execution.ROLE);
execution.removeContext();
// Make sure we mark the component manager for garbage collection as otherwise each JUnit test will
// have an instance of the Component Manager (will all the components it's holding), leading to
// out of memory errors when there are lots of tests...
this.componentManager = null;
}
代码示例来源:origin: org.xwiki.platform/xwiki-core-shared-tests
public void shutdown() throws Exception
{
Execution execution = getComponentManager().lookup(Execution.class);
execution.removeContext();
// Make sure we mark the component manager for garbage collection as otherwise each JUnit test will
// have an instance of the Component Manager (will all the components it's holding), leading to
// out of memory errors when there are lots of tests...
this.componentManager = null;
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-tool-test-component
public void shutdown() throws Exception
{
Execution execution = getComponentManager().getInstance(Execution.class);
execution.removeContext();
// Clean possible resources some components might hold
this.componentManager.dispose();
// Make sure we mark the component manager for garbage collection as otherwise each JUnit test will
// have an instance of the Component Manager (will all the components it's holding), leading to
// out of memory errors when there are lots of tests...
this.componentManager = null;
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-context
@Override
public void run()
{
// Create a clean Execution Context
ExecutionContext context = new ExecutionContext();
try {
this.componentManager.<ExecutionContextManager>getInstance(ExecutionContextManager.class)
.initialize(context);
} catch (Exception e) {
throw new RuntimeException("Failed to initialize Runnable [" + this.runnable + "] execution context", e);
}
try {
this.runnable.run();
} finally {
try {
this.componentManager.<Execution>getInstance(Execution.class).removeContext();
} catch (ComponentLookupException e) {
throw new RuntimeException("Failed to cleanup ExecutionContext after Runnable execution", e);
}
}
}
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-resource-servlet
private void cleanupComponents() throws ServletException
{
Container container;
try {
container = this.rootComponentManager.getInstance(Container.class);
} catch (ComponentLookupException e) {
throw new ServletException("Failed to locate a Container component", e);
}
Execution execution;
try {
execution = this.rootComponentManager.getInstance(Execution.class);
} catch (ComponentLookupException e) {
throw new ServletException("Failed to locate a Execution component", e);
}
// We must ensure we clean the ThreadLocal variables located in the Container and Execution components as
// otherwise we will have a potential memory leak.
container.removeRequest();
container.removeResponse();
container.removeSession();
execution.removeContext();
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
protected void cleanupComponents()
{
Container container = (Container) Utils.getComponent(Container.class);
Execution execution = (Execution) Utils.getComponent(Execution.class);
// We must ensure we clean the ThreadLocal variables located in the Container and Execution
// components as otherwise we will have a potential memory leak.
container.removeRequest();
container.removeResponse();
container.removeSession();
execution.removeContext();
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-gwt-api
private void cleanupContainerComponent()
{
Container container = Utils.getComponent(Container.class);
Execution execution = Utils.getComponent(Execution.class);
// We must ensure we clean the ThreadLocal variables located in the Container and Execution
// components as otherwise we will have a potential memory leak.
container.removeRequest();
container.removeResponse();
container.removeSession();
execution.removeContext();
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
protected void cleanupComponents()
{
Container container = Utils.getComponent(Container.class);
Execution execution = Utils.getComponent(Execution.class);
// We must ensure we clean the ThreadLocal variables located in the Container and Execution
// components as otherwise we will have a potential memory leak.
container.removeRequest();
container.removeResponse();
container.removeSession();
execution.removeContext();
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-scheduler-api
@Override
public final void execute(JobExecutionContext jobContext) throws JobExecutionException
{
JobDataMap data = jobContext.getJobDetail().getJobDataMap();
// The XWiki context was saved in the Job execution data map. Get it as we'll retrieve
// the script to execute from it.
this.xcontext = (XWikiContext) data.get("context");
// Clone the XWikiContex to have a new one for each run
this.xcontext = this.xcontext.clone();
// Init execution context
Execution execution;
try {
ExecutionContextManager ecim = Utils.getComponent(ExecutionContextManager.class);
execution = Utils.getComponent(Execution.class);
ExecutionContext context = new ExecutionContext();
// Bridge with old XWiki Context, required for old code
this.xcontext.declareInExecutionContext(context);
ecim.initialize(context);
} catch (ExecutionContextException e) {
throw new JobExecutionException("Fail to initialize execution context", e);
}
try {
// Execute the job
executeJob(jobContext);
} finally {
// We must ensure we clean the ThreadLocal variables located in the Execution
// component as otherwise we will have a potential memory leak.
execution.removeContext();
}
}
代码示例来源:origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler
execution.removeContext();
代码示例来源:origin: org.xwiki.platform/xwiki-platform-webdav-server
/**
* We must ensure we clean the ThreadLocal variables located in the Container and Execution
* components as otherwise we will have a potential memory leak.
*/
public void cleaUp(WebdavRequest request, XWikiDavContext context)
{
Container container = (Container) Utils.getComponent(Container.class);
Execution execution = (Execution) Utils.getComponent(Execution.class);
container.removeRequest();
container.removeResponse();
container.removeSession();
execution.removeContext();
getDavSessionProvider().releaseSession(request);
if (context != null) {
context.cleanUp();
}
}
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-search-solr-api
this.logger.error("Failed to process entry [{}]", batchEntry, e);
} finally {
this.execution.removeContext();
代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-test
((MutableRenderingContext) renderingContext).pop();
Execution execution = componentManager.getInstance(Execution.class);
execution.removeContext();
代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-test
private String convert(String source, String sourceSyntaxId, String targetSyntaxId) throws Exception
{
String result;
ExecutionContext executionContext = new ExecutionContext();
ExecutionContextManager executionContextManager = componentManager.getInstance(ExecutionContextManager.class);
executionContextManager.initialize(executionContext);
// Set TargetSyntax for Macro tests
RenderingContext renderingContext = componentManager.getInstance(RenderingContext.class);
((MutableRenderingContext) renderingContext).push(renderingContext.getTransformation(),
renderingContext.getXDOM(), renderingContext.getDefaultSyntax(), renderingContext.getTransformationId(),
renderingContext.isRestricted(), Syntax.valueOf(targetSyntaxId));
try {
if (isStreamingTest(sourceSyntaxId, targetSyntaxId)) {
StreamParser parser = getComponentManager().getInstance(StreamParser.class, sourceSyntaxId);
PrintRendererFactory rendererFactory =
getComponentManager().getInstance(PrintRendererFactory.class, targetSyntaxId);
result = convert(source, parser, rendererFactory);
} else {
Parser parser = getComponentManager().getInstance(Parser.class, sourceSyntaxId);
BlockRenderer blockRenderer = getComponentManager().getInstance(BlockRenderer.class, targetSyntaxId);
result = convert(source, parser, blockRenderer);
}
} finally {
((MutableRenderingContext) renderingContext).pop();
Execution execution = componentManager.getInstance(Execution.class);
execution.removeContext();
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!