Procházet zdrojové kódy

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

(cherry picked from commit 63ce1593c5b78eb172773e7498d9c321debe81e8)
Jason Lowe před 8 roky
rodič
revize
44b3c6ffaa

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/LevelDBCacheTimelineStore.java

@@ -286,6 +286,7 @@ public class LevelDBCacheTimelineStore extends KeyValueBasedTimelineStore {
         }
       };
     }
+    static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
     @SuppressWarnings("unchecked")
     private V getEntityForKey(byte[] key) throws IOException {
@@ -293,8 +294,7 @@ public class LevelDBCacheTimelineStore extends KeyValueBasedTimelineStore {
       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) {