You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ek...@apache.org on 2015/01/14 03:46:32 UTC
svn commit: r1651558 -
/hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSCleanup.java
Author: ekoifman
Date: Wed Jan 14 02:46:32 2015
New Revision: 1651558
URL: http://svn.apache.org/r1651558
Log:
HIVE-8914 HDFSCleanup thread holds reference to FileSystem (shanyu zhao via Eugene Koifman)
Modified:
hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSCleanup.java
Modified: hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSCleanup.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSCleanup.java?rev=1651558&r1=1651557&r2=1651558&view=diff
==============================================================================
--- hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSCleanup.java (original)
+++ hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSCleanup.java Wed Jan 14 02:46:32 2015
@@ -91,18 +91,25 @@ public class HDFSCleanup extends Thread
*
*/
public void run() {
- FileSystem fs = null;
while (!stop) {
try {
// Put each check in a separate try/catch, so if that particular
// cycle fails, it'll try again on the next cycle.
+ FileSystem fs=null;
try {
- if (fs == null) {
- fs = new Path(storage_root).getFileSystem(appConf);
- }
+ fs = new Path(storage_root).getFileSystem(appConf);
checkFiles(fs);
} catch (Exception e) {
LOG.error("Cleanup cycle failed: " + e.getMessage());
+ } finally {
+ if(fs != null) {
+ try {
+ fs.close();
+ }
+ catch (Exception e) {
+ LOG.error("Closing file system failed: " + e.getMessage());
+ }
+ }
}
long sleepMillis = (long) (Math.random() * interval);