Replaced printlns with logging, moved delete() to FileUtils.

This commit is contained in:
akwizgran
2011-06-27 10:38:30 +01:00
parent eaf52f57e7
commit d193f23e4c
8 changed files with 168 additions and 66 deletions

View File

@@ -6,6 +6,8 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.briar.api.crypto.Password;
import net.sf.briar.api.db.DatabaseComponent;
@@ -18,6 +20,9 @@ import com.google.inject.Inject;
class H2Database extends JdbcDatabase {
private static final Logger LOG =
Logger.getLogger(H2Database.class.getName());
private final Password password;
private final File home;
private final String url;
@@ -37,7 +42,7 @@ class H2Database extends JdbcDatabase {
}
public void close() throws DbException {
System.out.println("Closing database");
if(LOG.isLoggable(Level.FINE)) LOG.fine("Closing database");
try {
super.closeAllConnections();
} catch(SQLException e) {
@@ -51,7 +56,7 @@ class H2Database extends JdbcDatabase {
long used = getDiskSpace(dir);
long quota = DatabaseComponent.MAX_DB_SIZE - used;
long min = Math.min(free, quota);
System.out.println("Free space: " + min);
if(LOG.isLoggable(Level.FINE)) LOG.fine("Free space: " + min);
return min;
}