incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/2] git commit: Needed to close hdfs directory after use.
Date Fri, 26 Dec 2014 22:35:15 GMT
Needed to close hdfs directory after use.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/a9fd7052
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/a9fd7052
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/a9fd7052

Branch: refs/heads/master
Commit: a9fd7052705e3709d7492a5aa72fc79563990f8c
Parents: 3d502bf
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Dec 26 11:14:32 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Dec 26 11:14:32 2014 -0500

----------------------------------------------------------------------
 .../blur/manager/writer/IndexImporter.java      | 24 ++++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a9fd7052/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java b/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
index 92f623f..74363ea 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
@@ -139,18 +139,22 @@ public class IndexImporter extends TimerTask implements Closeable {
             Path inuse = new Path(file.getParent(), rename(file.getName(), INUSE));
             if (fileSystem.rename(file, inuse)) {
               HdfsDirectory hdfsDirectory = new HdfsDirectory(configuration, inuse);
-              if (DirectoryReader.indexExists(hdfsDirectory)) {
-                IndexAction indexAction = getIndexAction(hdfsDirectory, fileSystem);
-                _blurIndex.process(indexAction);
-                return;
-              } else {
-                Path badindex = new Path(file.getParent(), rename(file.getName(), BADINDEX));
-                if (fileSystem.rename(inuse, badindex)) {
-                  LOG.error("Directory found at [{0}] is not a vaild index, renaming to [{1}].",
inuse, badindex);
+              try {
+                if (DirectoryReader.indexExists(hdfsDirectory)) {
+                  IndexAction indexAction = getIndexAction(hdfsDirectory, fileSystem);
+                  _blurIndex.process(indexAction);
+                  return;
                 } else {
-                  LOG.fatal("Directory found at [{0}] is not a vaild index, could not rename
to [{1}].", inuse,
-                      badindex);
+                  Path badindex = new Path(file.getParent(), rename(file.getName(), BADINDEX));
+                  if (fileSystem.rename(inuse, badindex)) {
+                    LOG.error("Directory found at [{0}] is not a vaild index, renaming to
[{1}].", inuse, badindex);
+                  } else {
+                    LOG.fatal("Directory found at [{0}] is not a vaild index, could not rename
to [{1}].", inuse,
+                        badindex);
+                  }
                 }
+              } finally {
+                hdfsDirectory.close();
               }
             } else {
               LOG.fatal("Could not rename [{0}] to inuse dir.", file);


Mime
View raw message