Hi Thomas,
I managed to do what I wanted. Apparently I mixed up some of the environments. I used the
DocumentClass to get a document after I set did the setWiki() but that didn’t work. Once I
switched to the XWikiDocument, it worked like a charm. I will most likely have to do some
rework to have access to my components from a job :-)
Thanks for the help by answering my questions.
Br,
Peter
Van: Thomas Mortagne <thomas.mortagne(a)xwiki.com
<mailto:thomas.mortagne@xwiki.com>>
Onderwerp: Antw.: [xwiki-users] Question on Jobs and context (Peter Huisman)
Datum: 16 november 2015 18:27:13 CET
Aan: XWiki Users <users(a)xwiki.org <mailto:users@xwiki.org>>
Antwoord aan: XWiki Users <users(a)xwiki.org <mailto:users@xwiki.org>>
You should never use the same ExecutionContext or XWikiContext in
different threads since they are really not designed for this and you
will have weird random issue at best.
You can find a example of a component getting the current XWikiContext
and setting the current wiki id on
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
<https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-storage/src/main/java/org/xwiki/mail/internal/DatabaseMailStatusStore.java#L73>.