YARN-6738. LevelDBCacheTimelineStore should reuse ObjectMapper instances. Contributed by Zoltan Haindrich

This commit is contained in:
Jason Lowe 2017-06-27 17:12:42 -05:00
parent bc4dfe9c9c
commit 63ce1593c5
1 changed files with 2 additions and 2 deletions

View File

@ -286,6 +286,7 @@ public void remove() {
}
};
}
static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@SuppressWarnings("unchecked")
private V getEntityForKey(byte[] key) throws IOException {
@ -293,8 +294,7 @@ private V getEntityForKey(byte[] key) throws IOException {
if (resultRaw == null) {
return null;
}
ObjectMapper entityMapper = new ObjectMapper();
return (V) entityMapper.readValue(resultRaw, TimelineEntity.class);
return (V) OBJECT_MAPPER.readValue(resultRaw, TimelineEntity.class);
}
private byte[] getStartTimeKey(K entityId) {