|
@@ -98,78 +98,6 @@ class MapOutputLocation implements Writable, MRConstants {
|
|
|
mapTaskId;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Get the map output into a local file from the remote server.
|
|
|
- * We use the file system so that we generate checksum files on the data.
|
|
|
- * @param fileSys the filesystem to write the file to
|
|
|
- * @param localFilename the filename to write the data into
|
|
|
- * @param reduce the reduce id to get for
|
|
|
- * @param pingee a status object that wants to know when we make progress
|
|
|
- * @param timeout number of ms for connection and read timeout
|
|
|
- * @throws IOException when something goes wrong
|
|
|
- * @deprecated
|
|
|
- */
|
|
|
- @Deprecated
|
|
|
- public long getFile(FileSystem fileSys,
|
|
|
- Path localFilename,
|
|
|
- int reduce,
|
|
|
- Progressable pingee,
|
|
|
- int timeout) throws IOException, InterruptedException {
|
|
|
- boolean good = false;
|
|
|
- long totalBytes = 0;
|
|
|
- Thread currentThread = Thread.currentThread();
|
|
|
- URL path = new URL(toString() + "&reduce=" + reduce);
|
|
|
- try {
|
|
|
- URLConnection connection = path.openConnection();
|
|
|
- if (timeout > 0) {
|
|
|
- connection.setConnectTimeout(timeout);
|
|
|
- connection.setReadTimeout(timeout);
|
|
|
- }
|
|
|
- InputStream input = connection.getInputStream();
|
|
|
- try {
|
|
|
- OutputStream output = fileSys.create(localFilename);
|
|
|
- try {
|
|
|
- byte[] buffer = new byte[64 * 1024];
|
|
|
- if (currentThread.isInterrupted()) {
|
|
|
- throw new InterruptedException();
|
|
|
- }
|
|
|
- int len = input.read(buffer);
|
|
|
- while (len > 0) {
|
|
|
- totalBytes += len;
|
|
|
- output.write(buffer, 0 , len);
|
|
|
- if (pingee != null) {
|
|
|
- pingee.progress();
|
|
|
- }
|
|
|
- if (currentThread.isInterrupted()) {
|
|
|
- throw new InterruptedException();
|
|
|
- }
|
|
|
- len = input.read(buffer);
|
|
|
- }
|
|
|
- } finally {
|
|
|
- output.close();
|
|
|
- }
|
|
|
- } finally {
|
|
|
- input.close();
|
|
|
- }
|
|
|
- good = ((int) totalBytes) == connection.getContentLength();
|
|
|
- if (!good) {
|
|
|
- throw new IOException("Incomplete map output received for " + path +
|
|
|
- " (" + totalBytes + " instead of " +
|
|
|
- connection.getContentLength() + ")");
|
|
|
- }
|
|
|
- } finally {
|
|
|
- if (!good) {
|
|
|
- try {
|
|
|
- fileSys.delete(localFilename, true);
|
|
|
- totalBytes = 0;
|
|
|
- } catch (Throwable th) {
|
|
|
- // IGNORED because we are cleaning up
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return totalBytes;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Get the map output into a local file (either in the inmemory fs or on the
|
|
|
* local fs) from the remote server.
|