From version 32.1
edited by Thomas Mortagne
on 2018/11/19 16:47
To version 33.1
edited by Thomas Mortagne
on 2019/10/18 14:45
Change comment: There is no comment for this version

Summary

Details

ExtensionCode.ExtensionClass[0]
Description
... ... @@ -2,6 +2,30 @@
2 2  
3 3  It was first introduced as a replaced for the ##XWikiContext## which used to be passed as parameter in most XWiki classes methods. The ##ExecutionContext## context is stored in a ##ThreadLocal## and as such as be reached from anywhere should it be needed, the main entry point to access it is the component ##Execution##.
4 4  
5 += Push/pop ExecutionContext
6 +
7 +It's possible to push (and put) a new ExecutionContext in the current thread for various isolation needs.
8 +
9 +Since 11.9 it's recommended to do that trough the ##ExecutionContextManager## component:
10 +
11 +{{code language="java"}}
12 + @Inject
13 + private ExecutionContextManager contextManager;
14 +
15 + private void foo() throws ExecutionContextException
16 + {
17 + this.contextManager.push(new ExecutionContext(), true);
18 +
19 + try {
20 + [...]
21 + } finally {
22 + this.contextManager.push(new ExecutionContext(), true);
23 + }
24 + }
25 +{{/code}}
26 +
27 +Before 11.9 you can will use the APIs provided by ##Execution## component.
28 +
5 5  = Save and restore contextual information
6 6  
7 7  {{info}}

Get Connected