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 class LevelDBCacheTimelineStore extends KeyValueBasedTimelineStore {
} }
}; };
} }
static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private V getEntityForKey(byte[] key) throws IOException { private V getEntityForKey(byte[] key) throws IOException {
@ -293,8 +294,7 @@ public class LevelDBCacheTimelineStore extends KeyValueBasedTimelineStore {
if (resultRaw == null) { if (resultRaw == null) {
return null; return null;
} }
ObjectMapper entityMapper = new ObjectMapper(); return (V) OBJECT_MAPPER.readValue(resultRaw, TimelineEntity.class);
return (V) entityMapper.readValue(resultRaw, TimelineEntity.class);
} }
private byte[] getStartTimeKey(K entityId) { private byte[] getStartTimeKey(K entityId) {