XWIKI-8872: MessageTool can read from the wrong context in scheduler jobs or threads
* fix broken API in previous commit
(cherry picked from commit fb75332346d5e9406c9c92dc4557f150f414c753)