don't add the same object twice under rare cases where multiple threads are introducing the same new dynamic object

This commit is contained in:
kimchy 2010-08-10 09:18:53 +03:00
parent 96710fde24
commit 879191c435
1 changed files with 7 additions and 7 deletions

View File

@ -363,14 +363,14 @@ public class XContentObjectMapper implements XContentMapper, XContentIncludeInAl
objectMapper = mappers.get(currentFieldName);
if (objectMapper != null) {
objectMapper.parse(context);
} else {
BuilderContext builderContext = new BuilderContext(context.path());
objectMapper = XContentMapperBuilders.object(currentFieldName).enabled(true)
.dynamic(dynamic).pathType(pathType).dateTimeFormatter(dateTimeFormatters).build(builderContext);
putMapper(objectMapper);
objectMapper.parse(context);
context.addedMapper();
}
BuilderContext builderContext = new BuilderContext(context.path());
objectMapper = XContentMapperBuilders.object(currentFieldName).enabled(true)
.dynamic(dynamic).pathType(pathType).dateTimeFormatter(dateTimeFormatters).build(builderContext);
putMapper(objectMapper);
objectMapper.parse(context);
context.addedMapper();
}
} else {
// not dynamic, read everything up to end object