Merge -r 1170287:1170288 from trunk to branch-0.23 to fix MAPREDUCE-2549.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1170289 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ba9254b44f
commit
ad96dec426
|
@ -36,6 +36,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.eclipse.Activator;
|
import org.apache.hadoop.eclipse.Activator;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
|
import org.apache.hadoop.io.IOUtils;
|
||||||
import org.apache.hadoop.mapred.JobClient;
|
import org.apache.hadoop.mapred.JobClient;
|
||||||
import org.apache.hadoop.mapred.JobConf;
|
import org.apache.hadoop.mapred.JobConf;
|
||||||
import org.apache.hadoop.mapred.JobID;
|
import org.apache.hadoop.mapred.JobID;
|
||||||
|
@ -420,8 +421,14 @@ public class HadoopServer {
|
||||||
*/
|
*/
|
||||||
public void storeSettingsToFile(File file) throws IOException {
|
public void storeSettingsToFile(File file) throws IOException {
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
|
try {
|
||||||
this.conf.writeXml(fos);
|
this.conf.writeXml(fos);
|
||||||
fos.close();
|
fos.close();
|
||||||
|
fos = null;
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeStream(fos);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @inheritDoc */
|
/* @inheritDoc */
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.hadoop.eclipse.Activator;
|
||||||
import org.apache.hadoop.eclipse.ErrorMessageDialog;
|
import org.apache.hadoop.eclipse.ErrorMessageDialog;
|
||||||
import org.apache.hadoop.eclipse.server.HadoopServer;
|
import org.apache.hadoop.eclipse.server.HadoopServer;
|
||||||
import org.apache.hadoop.eclipse.server.JarModule;
|
import org.apache.hadoop.eclipse.server.JarModule;
|
||||||
|
import org.apache.hadoop.io.IOUtils;
|
||||||
import org.apache.hadoop.mapred.JobConf;
|
import org.apache.hadoop.mapred.JobConf;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -164,8 +165,13 @@ public class RunOnHadoopWizard extends Wizard {
|
||||||
// confDir);
|
// confDir);
|
||||||
File confFile = new File(confDir, "core-site.xml");
|
File confFile = new File(confDir, "core-site.xml");
|
||||||
FileOutputStream fos = new FileOutputStream(confFile);
|
FileOutputStream fos = new FileOutputStream(confFile);
|
||||||
|
try {
|
||||||
conf.writeXml(fos);
|
conf.writeXml(fos);
|
||||||
fos.close();
|
fos.close();
|
||||||
|
fos = null;
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeStream(fos);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.net.InetAddress;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
import org.apache.hadoop.io.IOUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a class used to get the current environment
|
* This is a class used to get the current environment
|
||||||
|
@ -62,9 +63,11 @@ public class Environment extends Properties {
|
||||||
|
|
||||||
Process pid = Runtime.getRuntime().exec(command);
|
Process pid = Runtime.getRuntime().exec(command);
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(pid.getInputStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(pid.getInputStream()));
|
||||||
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
String line = in.readLine();
|
String line = in.readLine();
|
||||||
if (line == null) break;
|
if (line == null)
|
||||||
|
break;
|
||||||
int p = line.indexOf("=");
|
int p = line.indexOf("=");
|
||||||
if (p != -1) {
|
if (p != -1) {
|
||||||
String name = line.substring(0, p);
|
String name = line.substring(0, p);
|
||||||
|
@ -73,6 +76,11 @@ public class Environment extends Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
|
in = null;
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeStream(in);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
pid.waitFor();
|
pid.waitFor();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
Loading…
Reference in New Issue