[xwiki-devs] [xwiki-notifications] r35963 - platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments

Thomas Mortagne thomas.mortagne at xwiki.com
Thu Mar 24 08:34:11 UTC 2011


On Thu, Mar 24, 2011 at 09:15, Vincent Massol <vincent at massol.net> wrote:
>
> On Mar 24, 2011, at 8:28 AM, tmortagne (SVN) wrote:
>
>> Author: tmortagne
>> Date: 2011-03-24 08:28:33 +0100 (Thu, 24 Mar 2011)
>> New Revision: 35963
>>
>> Modified:
>>   platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java
>> Log:
>> XWIKI-6164: PyGments: Failed to highlight content when web server is rendering another page in the same time
>>
>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java
>> ===================================================================
>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java      2011-03-24 02:11:29 UTC (rev 35962)
>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java      2011-03-24 07:28:33 UTC (rev 35963)
>> @@ -210,7 +210,7 @@
>>      * @return the highlighted version of the provided source.
>>      * @throws ParseException the highlighting failed.
>>      */
>> -    private List<Block> highlight(String syntaxId, String code) throws ParseException
>> +    private synchronized List<Block> highlight(String syntaxId, String code) throws ParseException
>>     {
>>         PythonInterpreter interpreter = getPythonInterpreter();
>
> Cool that we fixed this one!
>
> IMO we need a comment mentioning that getPythonInterpreter() is not thread safe (if that's the problem).

The real thing is that we don't recreate an interpreter each time we
highlight something and a Jython interpreter seems to be be thread
safe it seems.

But I will add something, it's better indeed.

>
> Thanks
> -Vincent
>
>>         BlocksGeneratorPygmentsListener listener = new BlocksGeneratorPygmentsListener(this.plainTextParser);
>>
>> _______________________________________________
>> notifications mailing list
>> notifications at xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/notifications
>
> _______________________________________________
> devs mailing list
> devs at xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs
>



-- 
Thomas Mortagne



More information about the devs mailing list