import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
-import java.util.logging.Level;
-
import net.rizon.acid.conf.Database;
import net.rizon.acid.core.Acidictive;
-import net.rizon.acid.core.Logger;
+import org.slf4j.LoggerFactory;
public class SQL extends Thread
{
- private static final Logger log = Logger.getLogger(SQL.class.getName());
+ private static final org.slf4j.Logger log = LoggerFactory.getLogger(SQL.class);
+
private PreparedStatement statement;
private ResultSet result;
private String url, username, password;
{
this.shuttingDown = true;
- log.log(Level.INFO, "Flushing pending SQL queries...");
+ log.info("Flushing pending SQL queries...");
synchronized (this.queryLock)
{
catch (InterruptedException ex) { }
}
- log.log(Level.INFO, "All SQL queries successfully flushed");
+ log.info("All SQL queries successfully flushed");
try { this.con.close(); }
catch (Exception ex) { }
this.last_connect = System.currentTimeMillis();
this.con = DriverManager.getConnection(this.url, this.username, this.password);
- log.log(Level.INFO, "Successfully connected to " + this.version() + " using " + this.con.getMetaData().getDriverName() + " (" + this.con.getMetaData().getDriverVersion() + ")");
+ log.info("Successfully connected to " + this.version() + " using " + this.con.getMetaData().getDriverName() + " (" + this.con.getMetaData().getDriverVersion() + ")");
}
public PreparedStatement prepare(final String statement) throws SQLException
public int executeUpdateBlocking(PreparedStatement statement) throws SQLException
{
int i = statement.executeUpdate();
- log.log(Level.FINE, "Successfully executed " + statement);
+ log.debug("Successfully executed " + statement);
return i;
}
{
this.result = statement.executeQuery();
- log.log(Level.FINE, "Successfully executed " + statement);
+ log.debug("Successfully executed " + statement);
return this.result;
}
q.executeUpdate();
lastQuery = System.currentTimeMillis();
- log.log(Level.FINE, "Successfully executed " + q + " in worker thread");
+ log.debug("Successfully executed " + q + " in worker thread");
}
catch (SQLException ex)
{
long now = System.currentTimeMillis() / 1000L;
if (lastWarn + 60 < now)
{
- log.log(Level.SEVERE, reason, ex);
+ log.error(reason, ex);
lastWarn = now;
}
}