james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ieu...@apache.org
Subject svn commit: r1195882 - in /james/mailbox/trunk/hbase/src/test: java/org/apache/james/mailbox/hbase/HBaseClusterSingleton.java resources/hdfs-site.xml
Date Tue, 01 Nov 2011 09:00:23 GMT
Author: ieugen
Date: Tue Nov  1 09:00:23 2011
New Revision: 1195882

URL: http://svn.apache.org/viewvc?rev=1195882&view=rev
Log:
Fixed cluster permission issue. Replaced finalizer with shutdown hook for shutting down the
minicluster.

Modified:
    james/mailbox/trunk/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseClusterSingleton.java
    james/mailbox/trunk/hbase/src/test/resources/hdfs-site.xml

Modified: james/mailbox/trunk/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseClusterSingleton.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseClusterSingleton.java?rev=1195882&r1=1195881&r2=1195882&view=diff
==============================================================================
--- james/mailbox/trunk/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseClusterSingleton.java
(original)
+++ james/mailbox/trunk/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseClusterSingleton.java
Tue Nov  1 09:00:23 2011
@@ -18,6 +18,7 @@
  ****************************************************************/
 package org.apache.james.mailbox.hbase;
 
+import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -53,8 +54,24 @@ public class HBaseClusterSingleton {
             try {
                 hbaseCluster = htu.startMiniCluster();
                 conf = hbaseCluster.getConfiguration();
-            } catch (Exception e) {
+            } catch (IOException e) {
                 throw new Exception("Error starting MiniCluster ", e);
+            } finally {
+                
+                if (hbaseCluster != null) {
+                    // add a shutdown hook for shuting down the minicluster.
+                    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+
+                        @Override
+                        public void run() {
+                            try {
+                                hbaseCluster.shutdown();
+                            } catch (IOException e) {
+                                throw new RuntimeException("Exception shuting down cluster.");
+                            }
+                        }
+                    }));
+                }
             }
         } else {
             conf = HBaseConfiguration.create();
@@ -80,14 +97,4 @@ public class HBaseClusterSingleton {
             hbaseAdmin.deleteTable(SUBSCRIPTIONS_TABLE);
         }
     }
-
-    @Override
-    protected void finalize() throws Throwable {
-        super.finalize();
-        if (useMiniCluster) {
-            if (hbaseCluster != null) {
-                hbaseCluster.shutdown();
-            }
-        }
-    }
 }

Modified: james/mailbox/trunk/hbase/src/test/resources/hdfs-site.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/hbase/src/test/resources/hdfs-site.xml?rev=1195882&r1=1195881&r2=1195882&view=diff
==============================================================================
--- james/mailbox/trunk/hbase/src/test/resources/hdfs-site.xml (original)
+++ james/mailbox/trunk/hbase/src/test/resources/hdfs-site.xml Tue Nov  1 09:00:23 2011
@@ -17,7 +17,7 @@
 
 <property>
   <name>dfs.datanode.data.dir.perm</name>
-  <value>775</value>
+  <value>755</value>
   <description>Permissions for the directories on on the local filesystem where
   the DFS data node store its blocks. The permissions can either be octal or symbolic.
   </description>



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message