You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by dh...@apache.org on 2007/08/07 19:26:47 UTC
svn commit: r563574 - in /lucene/hadoop/branches/branch-0.14: CHANGES.txt
src/java/org/apache/hadoop/fs/FsShell.java
Author: dhruba
Date: Tue Aug 7 10:26:46 2007
New Revision: 563574
URL: http://svn.apache.org/viewvc?view=rev&rev=563574
Log:
HADOOP-1666. FsShell object can be used for multiple fs commands.
Contributed by Dhruba Borthakur.
Modified:
lucene/hadoop/branches/branch-0.14/CHANGES.txt
lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java
Modified: lucene/hadoop/branches/branch-0.14/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/CHANGES.txt?view=diff&rev=563574&r1=563573&r2=563574
==============================================================================
--- lucene/hadoop/branches/branch-0.14/CHANGES.txt (original)
+++ lucene/hadoop/branches/branch-0.14/CHANGES.txt Tue Aug 7 10:26:46 2007
@@ -450,6 +450,9 @@
144. HADOOP-1659. Fix a job id/job name mixup. (Arun C. Murthy via omalley)
+145. HADOOP-1666. FsShell object can be used for multiple fs commands.
+ Contributed by Dhruba Borthakur.
+
Release 0.13.0 - 2007-06-08
1. HADOOP-1047. Fix TestReplication to succeed more reliably.
Modified: lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java?view=diff&rev=563574&r1=563573&r2=563574
==============================================================================
--- lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java Tue Aug 7 10:26:46 2007
@@ -42,12 +42,19 @@
/**
*/
public FsShell() {
+ fs = null;
+ trash = null;
}
protected void init() throws IOException {
conf.setQuietMode(true);
- this.fs = FileSystem.get(conf);
- this.trash = new Trash(conf);
+ if (this.fs == null) {
+ this.fs = FileSystem.get(conf);
+ }
+ if (this.trash == null) {
+ this.trash = new Trash(conf);
+ }
+ System.out.println("XXX FsShell init done");
}
/**
@@ -1308,16 +1315,28 @@
System.err.println(cmd.substring(1) + ": " +
e.getLocalizedMessage());
} finally {
- fs.close();
}
return exitCode;
}
+ public void close() throws IOException {
+ if (fs != null) {
+ fs.close();
+ fs = null;
+ }
+ }
+
/**
* main() has some simple utility methods
*/
public static void main(String argv[]) throws Exception {
- int res = new FsShell().doMain(new Configuration(), argv);
+ FsShell shell = new FsShell();
+ int res;
+ try {
+ res = shell.doMain(new Configuration(), argv);
+ } finally {
+ shell.close();
+ }
System.exit(res);
}