On Tue, May 13, 2014 at 6:29 PM, Jeremie BOUSQUET
<jeremie.bousquet(a)gmail.com> wrote:
2014-05-13 17:53 GMT+02:00 Thomas Mortagne
<thomas.mortagne(a)xwiki.com>om>:
The ExecutionContext returned by
execution.getContext(); comes from a
ThreadLocal which means it's not a singleton associated to the main
wiki but a new ExecutionContext generated for each http request.
That is what I understood, but that means that for my component to operate
on correct wiki (in correct context), it should reassign his own "context"
member for each request - and not do it once at component initialization
time.
I'm not sure I understand, are you talking about storing the
XWikiContext in your component instance at init ?
The XWikiContext should never ever be stored, instead you should
always request the current one when you need it. Among other things
the XWikiContext is not thread safe at all and is supposed to always
be used in the Thread it's been created for.
By the way you should really use Provider<XWikiContext> component instead.
I will, thanks. Does it have a different/better behaviour or is just the
preferred way ?
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne