incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [5/6] git commit: Making the closing of indexes in the sessions quiet.
Date Wed, 08 Jan 2014 03:24:14 GMT
Making the closing of indexes in the sessions quiet.


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

Branch: refs/heads/apache-blur-0.2
Commit: ef3f28f3faac78d7793037b68b0615786d5e8d66
Parents: a489dfe
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Jan 7 21:46:47 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Jan 7 21:46:47 2014 -0500

----------------------------------------------------------------------
 .../org/apache/blur/server/ShardServerContext.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ef3f28f3/blur-core/src/main/java/org/apache/blur/server/ShardServerContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/ShardServerContext.java b/blur-core/src/main/java/org/apache/blur/server/ShardServerContext.java
index 5ef0fdb..e86d2d6 100644
--- a/blur-core/src/main/java/org/apache/blur/server/ShardServerContext.java
+++ b/blur-core/src/main/java/org/apache/blur/server/ShardServerContext.java
@@ -16,6 +16,7 @@ package org.apache.blur.server;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+import java.io.Closeable;
 import java.io.IOException;
 import java.net.SocketAddress;
 import java.util.Collection;
@@ -26,7 +27,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.thirdparty.thrift_0_9_0.server.ServerContext;
-import org.apache.hadoop.io.IOUtils;
 
 /**
  * The thrift session that will hold index reader references to maintain across
@@ -89,11 +89,21 @@ public class ShardServerContext extends BlurServerContext implements ServerConte
     Collection<IndexSearcherClosable> values = _indexSearcherMap.values();
     for (IndexSearcherClosable indexSearcherClosable : values) {
       LOG.debug("Closing [{0}]", indexSearcherClosable);
-      IOUtils.cleanup(LOG, indexSearcherClosable);
+      closeQuietly(indexSearcherClosable);
     }
     _indexSearcherMap.clear();
   }
 
+  public static void closeQuietly(Closeable closeable) {
+    try {
+      if (closeable != null) {
+        closeable.close();
+      }
+    } catch (IOException e) {
+      LOG.error("Closing [{0}]", closeable);
+    }
+  }
+
   /**
    * Gets the cached {@link IndexSearcherClosable} (if any) for the given table
    * and shard.


Mime
View raw message