diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobEndNotifier.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobEndNotifier.java index 1ce525490d..b2fa79808c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobEndNotifier.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobEndNotifier.java @@ -26,10 +26,10 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.params.ClientPNames; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.params.CoreConnectionPNames; +import org.apache.http.impl.client.HttpClientBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,10 +67,13 @@ private static JobEndStatusInfo createNotification(JobConf conf, private static int httpNotification(String uri, int timeout) throws IOException, URISyntaxException { - DefaultHttpClient client = new DefaultHttpClient(); - client.getParams() - .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, timeout) - .setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, (long) timeout); + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + httpClientBuilder.setDefaultRequestConfig( + RequestConfig.custom() + .setConnectionRequestTimeout(timeout) + .setSocketTimeout(timeout) + .build()); + HttpClient client = httpClientBuilder.build(); HttpGet httpGet = new HttpGet(new URI(uri)); httpGet.setHeader("Accept", "*/*"); return client.execute(httpGet).getStatusLine().getStatusCode(); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobEndNotifier.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobEndNotifier.java index e3d1241cdc..46b581d2d0 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobEndNotifier.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobEndNotifier.java @@ -139,7 +139,7 @@ public void testLocalJobRunnerUriSubstitution() throws InterruptedException { baseUrl + "jobend?jobid=$jobId&status=$jobStatus"); JobEndNotifier.localRunnerNotification(jobConf, jobStatus); - // No need to wait for the notification to go thru since calls are + // No need to wait for the notification to go through since calls are // synchronous // Validate params