Skip to content

Commit

Permalink
(#2964) Remove auto-batching statements
Browse files Browse the repository at this point in the history
They don't add a huge amount of performance, and don't work at all on systems with limited resources.
  • Loading branch information
squaregoldfish committed Nov 16, 2024
1 parent f572af4 commit d1c3296
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import uk.ac.exeter.QuinCe.data.Instrument.SensorDefinition.SensorType;
import uk.ac.exeter.QuinCe.data.Instrument.SensorDefinition.SensorsConfiguration;
import uk.ac.exeter.QuinCe.data.Instrument.SensorDefinition.Variable;
import uk.ac.exeter.QuinCe.utils.AutoBatchPreparedStatement;
import uk.ac.exeter.QuinCe.utils.DatabaseException;
import uk.ac.exeter.QuinCe.utils.DatabaseUtils;
import uk.ac.exeter.QuinCe.utils.DateTimeUtils;
Expand Down Expand Up @@ -330,7 +329,7 @@ public static void storeSensorValues(Connection conn,
boolean autoCommitStatus = true;

PreparedStatement addStmt = null;
AutoBatchPreparedStatement updateStmt = null;
PreparedStatement updateStmt = null;
ResultSet generatedKeys;

try {
Expand All @@ -341,8 +340,7 @@ public static void storeSensorValues(Connection conn,

addStmt = conn.prepareStatement(STORE_NEW_SENSOR_VALUE_STATEMENT,
Statement.RETURN_GENERATED_KEYS);
updateStmt = new AutoBatchPreparedStatement(conn,
UPDATE_SENSOR_VALUE_STATEMENT);
updateStmt = conn.prepareStatement(UPDATE_SENSOR_VALUE_STATEMENT);

DataSet dataSet = null;
Instrument instrument = null;
Expand Down Expand Up @@ -448,7 +446,7 @@ public static void storeSensorValues(Connection conn,
} catch (Exception e) {
try {
addStmt.close();
updateStmt.abort();
updateStmt.close();

conn.rollback();
conn.setAutoCommit(autoCommitStatus);
Expand Down
168 changes: 0 additions & 168 deletions WebApp/src/uk/ac/exeter/QuinCe/utils/AutoBatchPreparedStatement.java

This file was deleted.

0 comments on commit d1c3296

Please sign in to comment.