From core-commits-return-6318-apmail-hadoop-core-commits-archive=hadoop.apache.org@hadoop.apache.org Mon Oct 06 10:43:18 2008 Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 84679 invoked from network); 6 Oct 2008 10:43:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Oct 2008 10:43:18 -0000 Received: (qmail 16630 invoked by uid 500); 6 Oct 2008 10:43:17 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 16576 invoked by uid 500); 6 Oct 2008 10:43:16 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 16567 invoked by uid 99); 6 Oct 2008 10:43:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2008 03:43:15 -0700 X-ASF-Spam-Status: No, hits=-1999.9 required=10.0 tests=ALL_TRUSTED,DNS_FROM_SECURITYSAGE X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Oct 2008 10:42:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 091BB238889D; Mon, 6 Oct 2008 03:42:18 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r702086 - in /hadoop/core/trunk: ./ src/core/org/apache/hadoop/conf/ src/core/org/apache/hadoop/fs/ src/core/org/apache/hadoop/record/compiler/ src/mapred/org/apache/hadoop/mapred/ Date: Mon, 06 Oct 2008 10:42:17 -0000 To: core-commits@hadoop.apache.org From: johan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081006104218.091BB238889D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: johan Date: Mon Oct 6 03:42:16 2008 New Revision: 702086 URL: http://svn.apache.org/viewvc?rev=702086&view=rev Log: HADOOP-4253. Fix various warnings generated by findbugs. Following deprecated methods in RawLocalFileSystem are removed: public String getName() public void lock(Path p, boolean shared) public void release(Path p) (Suresh Srinivas via johan) Modified: hadoop/core/trunk/CHANGES.txt hadoop/core/trunk/src/core/org/apache/hadoop/conf/Configuration.java hadoop/core/trunk/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java hadoop/core/trunk/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CGenerator.java hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CppGenerator.java hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/JRecord.java hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java Modified: hadoop/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/CHANGES.txt (original) +++ hadoop/core/trunk/CHANGES.txt Mon Oct 6 03:42:16 2008 @@ -7,6 +7,13 @@ HADOOP-4210. Fix findbugs warnings for equals implementations of mapred ID classes. Removed public, static ID::read and ID::forName; made ID an abstract class. (Suresh Srinivas via cdouglas) + + HADOOP-4253. Fix various warnings generated by findbugs. + Following deprecated methods in RawLocalFileSystem are removed: + public String getName() + public void lock(Path p, boolean shared) + public void release(Path p) + (Suresh Srinivas via johan) NEW FEATURES Modified: hadoop/core/trunk/src/core/org/apache/hadoop/conf/Configuration.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/conf/Configuration.java?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/src/core/org/apache/hadoop/conf/Configuration.java (original) +++ hadoop/core/trunk/src/core/org/apache/hadoop/conf/Configuration.java Mon Oct 6 03:42:16 2008 @@ -192,11 +192,18 @@ LOG.debug(StringUtils.stringifyException (new IOException("config(config)"))); } - this.resources = (ArrayList)other.resources.clone(); - if (other.properties != null) - this.properties = (Properties)other.properties.clone(); - if (other.overlay!=null) - this.overlay = (Properties)other.overlay.clone(); + + this.resources = (ArrayList)other.resources.clone(); + synchronized(other) { + if (other.properties != null) { + this.properties = (Properties)other.properties.clone(); + } + + if (other.overlay!=null) { + this.overlay = (Properties)other.overlay.clone(); + } + } + this.finalParameters = new HashSet(other.finalParameters); } Modified: hadoop/core/trunk/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java (original) +++ hadoop/core/trunk/src/core/org/apache/hadoop/fs/ChecksumFileSystem.java Mon Oct 6 03:42:16 2008 @@ -484,10 +484,7 @@ throws IOException { if (!fs.isDirectory(src)) { // source is a file fs.copyToLocalFile(src, dst); - FileSystem localFs = getLocal(getConf()); - if (localFs instanceof ChecksumFileSystem) { - localFs = ((ChecksumFileSystem) localFs).getRawFileSystem(); - } + FileSystem localFs = getLocal(getConf()).getRawFileSystem(); if (localFs.isDirectory(dst)) { dst = new Path(dst, src.getName()); } Modified: hadoop/core/trunk/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java (original) +++ hadoop/core/trunk/src/core/org/apache/hadoop/fs/RawLocalFileSystem.java Mon Oct 6 03:42:16 2008 @@ -37,11 +37,6 @@ public class RawLocalFileSystem extends FileSystem { static final URI NAME = URI.create("file:///"); private Path workingDir; - TreeMap sharedLockDataSet = - new TreeMap(); - TreeMap nonsharedLockDataSet = - new TreeMap(); - TreeMap lockObjSet = new TreeMap(); public RawLocalFileSystem() { workingDir = new Path(System.getProperty("user.dir")).makeQualified(this); @@ -56,9 +51,6 @@ return new File(path.toUri().getPath()); } - /** @deprecated */ - public String getName() { return "local"; } - public URI getUri() { return NAME; } public void initialize(URI uri, Configuration conf) { @@ -336,58 +328,6 @@ return workingDir; } - /** @deprecated */ @Deprecated - public void lock(Path p, boolean shared) throws IOException { - File f = pathToFile(p); - f.createNewFile(); - - if (shared) { - FileInputStream lockData = new FileInputStream(f); - FileLock lockObj = - lockData.getChannel().lock(0L, Long.MAX_VALUE, shared); - synchronized (this) { - sharedLockDataSet.put(f, lockData); - lockObjSet.put(f, lockObj); - } - } else { - FileOutputStream lockData = new FileOutputStream(f); - FileLock lockObj = lockData.getChannel().lock(0L, Long.MAX_VALUE, shared); - synchronized (this) { - nonsharedLockDataSet.put(f, lockData); - lockObjSet.put(f, lockObj); - } - } - } - - /** @deprecated */ @Deprecated - public void release(Path p) throws IOException { - File f = pathToFile(p); - - FileLock lockObj; - FileInputStream sharedLockData; - FileOutputStream nonsharedLockData; - synchronized (this) { - lockObj = lockObjSet.remove(f); - sharedLockData = sharedLockDataSet.remove(f); - nonsharedLockData = nonsharedLockDataSet.remove(f); - } - - if (lockObj == null) { - throw new IOException("Given target not held as lock"); - } - if (sharedLockData == null && nonsharedLockData == null) { - throw new IOException("Given target not held as lock"); - } - - lockObj.release(); - - if (sharedLockData != null) { - sharedLockData.close(); - } else { - nonsharedLockData.close(); - } - } - // In the case of the local filesystem, we can just rename the file. public void moveFromLocalFile(Path src, Path dst) throws IOException { rename(src, dst); Modified: hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CGenerator.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CGenerator.java?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CGenerator.java (original) +++ hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CGenerator.java Mon Oct 6 03:42:16 2008 @@ -42,26 +42,30 @@ throws IOException { name = new File(destDir, (new File(name)).getName()).getAbsolutePath(); FileWriter cc = new FileWriter(name+".c"); - FileWriter hh = new FileWriter(name+".h"); - - hh.write("#ifndef __"+name.toUpperCase().replace('.','_')+"__\n"); - hh.write("#define __"+name.toUpperCase().replace('.','_')+"__\n"); - hh.write("#include \"recordio.h\"\n"); - for (Iterator iter = ilist.iterator(); iter.hasNext();) { - hh.write("#include \""+iter.next().getName()+".h\"\n"); - } - - cc.write("#include \""+name+".h\"\n"); - - /* - for (Iterator iter = rlist.iterator(); iter.hasNext();) { - iter.next().genCppCode(hh, cc); + try { + FileWriter hh = new FileWriter(name+".h"); + try { + hh.write("#ifndef __"+name.toUpperCase().replace('.','_')+"__\n"); + hh.write("#define __"+name.toUpperCase().replace('.','_')+"__\n"); + hh.write("#include \"recordio.h\"\n"); + for (Iterator iter = ilist.iterator(); iter.hasNext();) { + hh.write("#include \""+iter.next().getName()+".h\"\n"); + } + + cc.write("#include \""+name+".h\"\n"); + + /* + for (Iterator iter = rlist.iterator(); iter.hasNext();) { + iter.next().genCppCode(hh, cc); + } + */ + + hh.write("#endif //"+name.toUpperCase().replace('.','_')+"__\n"); + } finally { + hh.close(); } - */ - - hh.write("#endif //"+name.toUpperCase().replace('.','_')+"__\n"); - - hh.close(); - cc.close(); + } finally { + cc.close(); + } } } Modified: hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CppGenerator.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CppGenerator.java?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CppGenerator.java (original) +++ hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/CppGenerator.java Mon Oct 6 03:42:16 2008 @@ -41,28 +41,34 @@ ArrayList rlist, String destDir, ArrayList options) throws IOException { name = new File(destDir, (new File(name)).getName()).getAbsolutePath(); + FileWriter cc = new FileWriter(name+".cc"); - FileWriter hh = new FileWriter(name+".hh"); - - String fileName = (new File(name)).getName(); - hh.write("#ifndef __"+fileName.toUpperCase().replace('.','_')+"__\n"); - hh.write("#define __"+fileName.toUpperCase().replace('.','_')+"__\n"); - hh.write("#include \"recordio.hh\"\n"); - hh.write("#include \"recordTypeInfo.hh\"\n"); - for (Iterator iter = ilist.iterator(); iter.hasNext();) { - hh.write("#include \""+iter.next().getName()+".hh\"\n"); + try { + FileWriter hh = new FileWriter(name+".hh"); + + try { + String fileName = (new File(name)).getName(); + hh.write("#ifndef __"+fileName.toUpperCase().replace('.','_')+"__\n"); + hh.write("#define __"+fileName.toUpperCase().replace('.','_')+"__\n"); + hh.write("#include \"recordio.hh\"\n"); + hh.write("#include \"recordTypeInfo.hh\"\n"); + for (Iterator iter = ilist.iterator(); iter.hasNext();) { + hh.write("#include \""+iter.next().getName()+".hh\"\n"); + } + + cc.write("#include \""+fileName+".hh\"\n"); + cc.write("#include \"utils.hh\"\n"); + + for (Iterator iter = rlist.iterator(); iter.hasNext();) { + iter.next().genCppCode(hh, cc, options); + } + + hh.write("#endif //"+fileName.toUpperCase().replace('.','_')+"__\n"); + } finally { + hh.close(); + } + } finally { + cc.close(); } - - cc.write("#include \""+fileName+".hh\"\n"); - cc.write("#include \"utils.hh\"\n"); - - for (Iterator iter = rlist.iterator(); iter.hasNext();) { - iter.next().genCppCode(hh, cc, options); - } - - hh.write("#endif //"+fileName.toUpperCase().replace('.','_')+"__\n"); - - hh.close(); - cc.close(); } } Modified: hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/JRecord.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/JRecord.java?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/JRecord.java (original) +++ hadoop/core/trunk/src/core/org/apache/hadoop/record/compiler/JRecord.java Mon Oct 6 03:42:16 2008 @@ -155,6 +155,8 @@ String pkg = module; String pkgpath = pkg.replaceAll("\\.", "/"); File pkgdir = new File(destDir, pkgpath); + + final File jfile = new File(pkgdir, name+".java"); if (!pkgdir.exists()) { // create the pkg directory boolean ret = pkgdir.mkdirs(); @@ -165,9 +167,7 @@ // not a directory throw new IOException(pkgpath+" is not a directory."); } - File jfile = new File(pkgdir, name+".java"); - FileWriter jj = new FileWriter(jfile); - + CodeBuffer cb = new CodeBuffer(); cb.append("// File generated by hadoop record compiler. Do not edit.\n"); cb.append("package "+module+";\n\n"); @@ -456,8 +456,12 @@ cb.append("}\n"); cb.append("}\n"); - jj.write(cb.toString()); - jj.close(); + FileWriter jj = new FileWriter(jfile); + try { + jj.write(cb.toString()); + } finally { + jj.close(); + } } } Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java?rev=702086&r1=702085&r2=702086&view=diff ============================================================================== --- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java (original) +++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java Mon Oct 6 03:42:16 2008 @@ -551,7 +551,7 @@ @Override public void run() { - LOG.info("Starting thread: " + getName()); + LOG.info("Starting thread: " + this.getName()); while (true) { try { @@ -561,7 +561,7 @@ try { runningJobs.wait(); } catch (InterruptedException e) { - LOG.info("Shutting down: " + getName()); + LOG.info("Shutting down: " + this.getName()); return; } } @@ -592,7 +592,7 @@ waitingOn.wait(heartbeatInterval); } } catch (InterruptedException ie) { - LOG.info("Shutting down: " + getName()); + LOG.info("Shutting down: " + this.getName()); return; } }