in java/main/src/main/java/com/epam/deltix/hdtime/Formatters.java [558:584]
protected FormatTemplate getCachedOrNewTemplate(final String fmt, final HashMap<String, FormatTemplate> local) {
FormatTemplate f;
final HashMap<String, FormatTemplate> global = globalTemplateCache;
// Try to find in the global formatter cache
synchronized (global) {
f = global.get(fmt);
}
if (null == f) {
fb.clear();
parseFormat(fmt);
f = fb.get();
synchronized (global) {
FormatTemplate tmp = global.get(fmt);
if (null == tmp)
global.put(fmt, f);
else
f = tmp;
}
assert (null != f);
}
// Copy the reference to local cache
local.put(fmt, f);
return f;
}