[stringtemplate-interest] thread safety

Sam Harwell sharwell at pixelminegames.com
Sat Nov 14 13:35:45 PST 2009


I think all operations on StringTemplateGroup should be thread safe.
Operations on StringTemplate are not guaranteed to be thread safe, but
two templates returned by two calls to getInstanceOf are mutually thread
safe.

Sam

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Terence
Parr
Sent: Thursday, November 12, 2009 6:16 PM
To: StringTemplate Mailing List
Subject: [stringtemplate-interest] thread safety

so, currently in ST v3, only renderer tracking is thread safe:

     public void registerRenderer(Class attributeClassType,  
AttributeRenderer renderer) {
         if ( attributeRenderers==null ) {
             attributeRenderers = Collections.synchronizedMap(new  
HashMap<Class,AttributeRenderer>());
         }
         attributeRenderers.put(attributeClassType, renderer);
     }

All the other stuff isn't; not even adding attributes. the question  
is: what should be thread safe. seems weird to have multiple threads  
update a single template or group, but...thought i would ask.

Ter
_______________________________________________
stringtemplate-interest mailing list
stringtemplate-interest at antlr.org
http://www.antlr.org/mailman/listinfo/stringtemplate-interest


More information about the stringtemplate-interest mailing list