Skip to content

Commit

Permalink
MAPREDUCE-6264. Remove httpclient dependency from hadoop-mapreduce-cl…
Browse files Browse the repository at this point in the history
…ient. Contributed by Brahma Reddy Battula.
  • Loading branch information
aajisaka committed Feb 24, 2015
1 parent d4ac682 commit 0d7d508
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
3 changes: 3 additions & 0 deletions hadoop-mapreduce-project/CHANGES.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ Release 2.7.0 - UNRELEASED
MAPREDUCE-6225. Fix new findbug warnings in hadoop-mapreduce-client-core. MAPREDUCE-6225. Fix new findbug warnings in hadoop-mapreduce-client-core.
(Varun Saxena via junping_du) (Varun Saxena via junping_du)


MAPREDUCE-6264. Remove httpclient dependency from hadoop-mapreduce-client.
(Brahma Reddy Battula via aajisaka)

OPTIMIZATIONS OPTIMIZATIONS


MAPREDUCE-6169. MergeQueue should release reference to the current item MAPREDUCE-6169. MergeQueue should release reference to the current item
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@


import org.junit.Assert; import org.junit.Assert;


import org.apache.commons.httpclient.HttpStatus;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.http.HttpConfig.Policy; import org.apache.hadoop.http.HttpConfig.Policy;
import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.io.IOUtils;
Expand All @@ -57,6 +56,7 @@
import org.apache.hadoop.yarn.webapp.WebApps; import org.apache.hadoop.yarn.webapp.WebApps;
import org.apache.hadoop.yarn.webapp.test.WebAppTests; import org.apache.hadoop.yarn.webapp.test.WebAppTests;
import org.apache.hadoop.yarn.webapp.util.WebAppUtils; import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
import org.apache.http.HttpStatus;
import org.junit.Test; import org.junit.Test;


import com.google.common.net.HttpHeaders; import com.google.common.net.HttpHeaders;
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
package org.apache.hadoop.mapred; package org.apache.hadoop.mapred;


import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.concurrent.Delayed; import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;


import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.URI;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
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;


@InterfaceAudience.Private @InterfaceAudience.Private
@InterfaceStability.Unstable @InterfaceStability.Unstable
Expand Down Expand Up @@ -64,15 +66,14 @@ private static JobEndStatusInfo createNotification(JobConf conf,
} }


private static int httpNotification(String uri, int timeout) private static int httpNotification(String uri, int timeout)
throws IOException { throws IOException, URISyntaxException {
URI url = new URI(uri, false); DefaultHttpClient client = new DefaultHttpClient();
HttpClient httpClient = new HttpClient(); client.getParams()
httpClient.getParams().setSoTimeout(timeout); .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, timeout)
httpClient.getParams().setConnectionManagerTimeout(timeout); .setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, (long) timeout);

HttpGet httpGet = new HttpGet(new URI(uri));
HttpMethod method = new GetMethod(url.getEscapedURI()); httpGet.setHeader("Accept", "*/*");
method.setRequestHeader("Accept", "*/*"); return client.execute(httpGet).getStatusLine().getStatusCode();
return httpClient.executeMethod(method);
} }


// for use by the LocalJobRunner, without using a thread&queue, // for use by the LocalJobRunner, without using a thread&queue,
Expand Down

0 comments on commit 0d7d508

Please sign in to comment.