From 655110393bf90a7dac5d85f831ea225071f5f3c2 Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Wed, 12 Jul 2017 15:52:56 -0500 Subject: [PATCH] YARN-6797. TimelineWriter does not fully consume the POST response. Contributed by Jason Lowe --- .../hadoop/yarn/client/api/impl/TimelineWriter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineWriter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineWriter.java index 8fd0990165..b3a886baf1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineWriter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineWriter.java @@ -152,16 +152,20 @@ public ClientResponse doPostingObject(Object object, String path) { if (LOG.isDebugEnabled()) { LOG.debug("POST to " + resURI); } - return webResource.accept(MediaType.APPLICATION_JSON) + ClientResponse r = webResource.accept(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON) .post(ClientResponse.class, object); + r.bufferEntity(); + return r; } else if (path.equals("domain")) { if (LOG.isDebugEnabled()) { LOG.debug("PUT to " + resURI +"/" + path); } - return webResource.path(path).accept(MediaType.APPLICATION_JSON) + ClientResponse r = webResource.path(path).accept(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON) .put(ClientResponse.class, object); + r.bufferEntity(); + return r; } else { throw new YarnRuntimeException("Unknown resource type"); }