Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2017-08-29 18:29:07 -0400
committerRyan D. Brooks2017-08-30 12:11:02 -0400
commitbf3035f85acb3354bf94edafaddb221966c634b4 (patch)
tree2d3a40e32ab417e9ed0bb92755ed865be8808f35
parente02581faedfc8d647fd9ce0b1aabc5815ea69fc0 (diff)
downloadorg.eclipse.osee-bf3035f85acb3354bf94edafaddb221966c634b4.tar.gz
org.eclipse.osee-bf3035f85acb3354bf94edafaddb221966c634b4.tar.xz
org.eclipse.osee-bf3035f85acb3354bf94edafaddb221966c634b4.zip
bug: Handle reseting state between join cleaner calls
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/JoinCleanerCallable.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/JoinCleanerCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/JoinCleanerCallable.java
index ce08672b44..e25b6afd0f 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/JoinCleanerCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/JoinCleanerCallable.java
@@ -27,7 +27,7 @@ public class JoinCleanerCallable extends CancellableCallable<Void> {
private final Log logger;
private final JdbcClient jdbcClient;
- private String previousTableName = "";
+ private String previousTableName;
private long currentTime;
private OseePreparedStatement joinDelete;
private OseePreparedStatement cleanupDelete;
@@ -41,17 +41,24 @@ public class JoinCleanerCallable extends CancellableCallable<Void> {
return lifetime != -1 && issuedAt + lifetime < currentTime;
}
+ private void resetForNextCall() {
+ previousTableName = "";
+ currentTime = System.currentTimeMillis() / 1000;
+ joinDelete = null;
+ cleanupDelete = jdbcClient.getBatchStatement(DELETE_JOIN_CLEANUP);
+ }
+
@Override
public Void call() throws Exception {
try {
- currentTime = System.currentTimeMillis() / 1000;
-
- cleanupDelete = jdbcClient.getBatchStatement(DELETE_JOIN_CLEANUP);
+ resetForNextCall();
try {
jdbcClient.runQuery(this::processRow, SELECT_FROM_JOIN_CLEANUP);
} finally {
- joinDelete.execute();
cleanupDelete.execute();
+ if (joinDelete != null) {
+ joinDelete.execute();
+ }
}
} catch (Exception ex) {
logger.error(ex, "Error cleaning join tables");

Back to the top