Creating handelbars.Context using model hashmap locking the hashmap.

24 views
Skip to first unread message

C P

unread,
Oct 24, 2016, 9:16:41 AM10/24/16
to handlebars.java
while using template.apply() , where we have to pass Context as a first parameter.
We are creating this Context using a model which is a java.util.Hashmap.

Now this hashmap resource gets locked while creating the context.
Wanted to know is there a recommendation for using concurrenthashmap and not using the java.util.hashmap as a model, because this hashmap is getting locked and causing the subsequent threads wait for this resource.

Here is the code: here model is the java.util.Hashmap

hbContext = Context.newBuilder(model).resolver(FieldValueResolver.INSTANCE, MapValueResolver.INSTANCE,JavaBeanValueResolver.INSTANCE,MethodValueResolver.INSTANCE).build();

template.apply(hbContext, scriptContext.getWriter());



Thanks.
Reply all
Reply to author
Forward
0 new messages