YARN-4668. Reuse objectMapper instance in Yarn. (Yiqun Lin via gtcarrera9)
(cherry picked from commit 221582c4ab
)
This commit is contained in:
parent
58ac40b552
commit
2b0fd1f4e2
|
@ -85,6 +85,7 @@ public class TimelineClientImpl extends TimelineClient {
|
|||
|
||||
private static final Log LOG = LogFactory.getLog(TimelineClientImpl.class);
|
||||
private static final String RESOURCE_URI_STR = "/ws/v1/timeline/";
|
||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
private static final Joiner JOINER = Joiner.on("");
|
||||
public final static int DEFAULT_SOCKET_TIMEOUT = 1 * 60 * 1000; // 1 minute
|
||||
|
||||
|
@ -563,15 +564,14 @@ public class TimelineClientImpl extends TimelineClient {
|
|||
LOG.error("File [" + jsonFile.getAbsolutePath() + "] doesn't exist");
|
||||
return;
|
||||
}
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
YarnJacksonJaxbJsonProvider.configObjectMapper(mapper);
|
||||
YarnJacksonJaxbJsonProvider.configObjectMapper(MAPPER);
|
||||
TimelineEntities entities = null;
|
||||
TimelineDomains domains = null;
|
||||
try {
|
||||
if (type.equals(ENTITY_DATA_TYPE)) {
|
||||
entities = mapper.readValue(jsonFile, TimelineEntities.class);
|
||||
entities = MAPPER.readValue(jsonFile, TimelineEntities.class);
|
||||
} else if (type.equals(DOMAIN_DATA_TYPE)){
|
||||
domains = mapper.readValue(jsonFile, TimelineDomains.class);
|
||||
domains = MAPPER.readValue(jsonFile, TimelineDomains.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error when reading " + e.getMessage());
|
||||
|
|
Loading…
Reference in New Issue