Repository: ambari
Updated Branches:
  refs/heads/trunk 8cbe1e106 -> 2ca58368e


AMBARI-10904. Provide a configurable timeout setting on 
MetricsTimelineSink.emitMetrics. Sink connection problem. (swagle)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2ca58368
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2ca58368
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2ca58368

Branch: refs/heads/trunk
Commit: 2ca58368e60671580e246199da392167c371338e
Parents: 8cbe1e1
Author: Siddharth Wagle <swa...@hortonworks.com>
Authored: Wed May 6 18:12:39 2015 -0700
Committer: Siddharth Wagle <swa...@hortonworks.com>
Committed: Wed May 6 18:12:39 2015 -0700

----------------------------------------------------------------------
 .../metrics2/sink/timeline/AbstractTimelineMetricsSink.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca58368/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
----------------------------------------------------------------------
diff --git 
a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
 
b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
index 4b93f50..f18f52a 100644
--- 
a/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
+++ 
b/ambari-metrics/ambari-metrics-common/src/main/java/org/apache/hadoop/metrics2/sink/timeline/AbstractTimelineMetricsSink.java
@@ -54,6 +54,8 @@ public abstract class AbstractTimelineMetricsSink {
 
   public AbstractTimelineMetricsSink() {
     LOG = LogFactory.getLog(this.getClass());
+    httpClient.getParams().setSoTimeout(getTimeoutSeconds() * 1000);
+    httpClient.getParams().setConnectionManagerTimeout(getTimeoutSeconds() * 
1000);
   }
 
   protected void emitMetrics(TimelineMetrics metrics) throws IOException {
@@ -65,10 +67,11 @@ public abstract class AbstractTimelineMetricsSink {
 
       PostMethod postMethod = new PostMethod(connectUrl);
       postMethod.setRequestEntity(requestEntity);
-      postMethod.setParameter(HttpMethodParams.SO_TIMEOUT, 
String.valueOf(getTimeoutSeconds() * 1000));
       int statusCode = httpClient.executeMethod(postMethod);
+
       if (statusCode != 200) {
-        LOG.info("Unable to POST metrics to collector, " + connectUrl);
+        LOG.info("Unable to POST metrics to collector, " + connectUrl + ", " +
+          "statusCode = " + statusCode);
       } else {
         LOG.debug("Metrics posted to Collector " + connectUrl);
       }

Reply via email to