Kaynağa Gözat

HADOOP-4267. Occasional exceptions during shutting down HSQLDB is logged but not rethrown. Contributed by Enis Soztutar.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@702752 13f79535-47bb-0310-9956-ffa450edef68
Enis Soztutar 16 yıl önce
ebeveyn
işleme
6948842f98

+ 1 - 1
.eclipse.templates/.classpath

@@ -19,7 +19,7 @@
 	<classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
 	<classpathentry kind="lib" path="lib/commons-logging-api-1.0.4.jar"/>
 	<classpathentry kind="lib" path="lib/commons-net-1.4.1.jar"/>
-	<classpathentry kind="lib" path="lib/hsqldb.jar"/>
+	<classpathentry kind="lib" path="lib/hsqldb-1.8.0.10.jar"/>
 	<classpathentry kind="lib" path="lib/jets3t-0.6.1.jar"/>
 	<classpathentry kind="lib" path="lib/jetty-5.1.4.jar"/>
 	<classpathentry kind="lib" path="lib/jetty-ext/commons-el.jar"/>

+ 3 - 0
CHANGES.txt

@@ -867,6 +867,9 @@ Release 0.19.0 - Unreleased
     HADOOP-4256. Removes Completed and Failed Job tables from 
     jobqueue_details.jsp. (Sreekanth Ramakrishnan via ddas)
 
+    HADOOP-4267. Occasional exceptions during shutting down HSQLDB is logged 
+    but not rethrown. (enis) 
+
 Release 0.18.2 - Unreleased
 
   BUG FIXES

+ 0 - 0
lib/hsqldb-LICENSE.txt → lib/hsqldb-1.8.0.10.LICENSE.txt


+ 0 - 0
lib/hsqldb.jar → lib/hsqldb-1.8.0.10.jar


+ 17 - 7
src/examples/org/apache/hadoop/examples/DBCountPageView.java

@@ -49,6 +49,7 @@ import org.apache.hadoop.mapred.lib.db.DBConfiguration;
 import org.apache.hadoop.mapred.lib.db.DBInputFormat;
 import org.apache.hadoop.mapred.lib.db.DBOutputFormat;
 import org.apache.hadoop.mapred.lib.db.DBWritable;
+import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
 import org.hsqldb.Server;
@@ -99,13 +100,22 @@ public class DBCountPageView extends Configured implements Tool {
     connection.setAutoCommit(false);
   }
 
-  private void shutdown() throws SQLException {
-    connection.commit();
-    connection.close();
-    
-    if(server != null) {
-      server.stop();
-      server.shutdown();
+  private void shutdown() {
+    try {
+      connection.commit();
+      connection.close();
+    }catch (Throwable ex) {
+      LOG.warn("Exception occurred while closing connection :"
+          + StringUtils.stringifyException(ex));
+    } finally {
+      try {
+        if(server != null) {
+          server.shutdown();
+        }
+      }catch (Throwable ex) {
+        LOG.warn("Exception occurred while shutting down HSQLDB :"
+            + StringUtils.stringifyException(ex));
+      }
     }
   }