diff options
author | Ram Koya <rk541m@att.com> | 2018-09-13 14:58:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-13 14:58:18 +0000 |
commit | fb6bfe73b73a2eeb543883d0da14e301e0066aa2 (patch) | |
tree | 460d6c76b3782fddd9274fc3b7839ec8dffc1faa | |
parent | 8f2e78cc17997beb2cf410a26b6ff3e1d2644b4e (diff) | |
parent | 1cf4594108799897f096afc1ffb1dfb60e7aea31 (diff) |
Merge "Sonar fix in LogFileReader.java"
-rw-r--r-- | datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java index 8975f161..110c63de 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java @@ -188,6 +188,7 @@ public class LogfileLoader extends Thread { try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
}
idle = false;
} else {
@@ -332,26 +333,25 @@ public class LogfileLoader extends Thread { Connection conn = null;
try {
conn = db.getConnection();
- Statement stmt = conn.createStatement();
- // Build a bitset of all records in the LOG_RECORDS table
- // We need to run this SELECT in stages, because otherwise we run out of memory!
RLEBitSet nbs = new RLEBitSet();
- final long stepsize = 6000000L;
- boolean go_again = true;
- for (long i = 0; go_again; i += stepsize) {
- String sql = String.format("select RECORD_ID from LOG_RECORDS LIMIT %d,%d", i, stepsize);
- try(ResultSet rs = stmt.executeQuery(sql)) {
- go_again = false;
- while (rs.next()) {
- long n = rs.getLong("RECORD_ID");
- nbs.set(n);
- go_again = true;
+ try(Statement stmt = conn.createStatement()) {
+ // Build a bitset of all records in the LOG_RECORDS table
+ // We need to run this SELECT in stages, because otherwise we run out of memory!
+ final long stepsize = 6000000L;
+ boolean go_again = true;
+ for (long i = 0; go_again; i += stepsize) {
+ String sql = String.format("select RECORD_ID from LOG_RECORDS LIMIT %d,%d", i, stepsize);
+ try (ResultSet rs = stmt.executeQuery(sql)) {
+ go_again = false;
+ while (rs.next()) {
+ long n = rs.getLong("RECORD_ID");
+ nbs.set(n);
+ go_again = true;
+ }
}
}
}
- stmt.close();
seq_set = nbs;
-
// Compare with the range for this server
// Determine the next ID for this set of record IDs
RLEBitSet tbs = (RLEBitSet) nbs.clone();
|