After discussion and debug with Thomas Mortagne, it turns out that both the original problem described by the ticket as well as the problem that I mentioned in the previous comment are related to the fact that the velocity.templates property of the execution context is not reset when the context is prepared for the thread used for running the code of the job macro. This property is a stack and thus ends up manipulated by both the caller thread and the thread of the job macro itself, hence the race issues. |