[stringtemplate-interest] thread safety

Terence Parr parrt at antlr.org
Thu Nov 12 16:16:14 PST 2009


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


More information about the stringtemplate-interest mailing list