mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r899331 - /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java
Date Thu, 14 Jan 2010 17:55:37 GMT
Author: srowen
Date: Thu Jan 14 17:55:37 2010
New Revision: 899331

URL: http://svn.apache.org/viewvc?rev=899331&view=rev
Log:
One attempt to mitigate MAHOUT-247 -- finalizer would close the connection earlier

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java?rev=899331&r1=899330&r2=899331&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java
Thu Jan 14 17:55:37 2010
@@ -710,8 +710,10 @@
     }
 
     private void close() {
-      closed = true;
-      IOUtils.quietClose(resultSet, statement, connection);
+      if (!closed) {
+        closed = true;
+        IOUtils.quietClose(resultSet, statement, connection);
+      }
     }
 
     @Override
@@ -726,6 +728,15 @@
       }
     }
 
+    @Override
+    protected void finalize() throws Throwable {
+      try {
+        close();
+      } finally {
+        super.finalize();
+      }
+    }
+
   }
 
   private class ItemPrefCountRetriever implements Retriever<Long, Integer> {



Mime
View raw message