improvement to VitroJenaSDBModelMaker prompted by NIHVIVO-2119 (merge to trunk)
This commit is contained in:
parent
57d3d0df79
commit
7d69145534
1 changed files with 4 additions and 4 deletions
|
@ -94,14 +94,12 @@ public class VitroJenaSDBModelMaker implements ModelMaker {
|
||||||
private Store getStore() {
|
private Store getStore() {
|
||||||
Store store = null;
|
Store store = null;
|
||||||
boolean goodStore = false;
|
boolean goodStore = false;
|
||||||
boolean badConn = false;
|
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
while (!goodStore && tries < MAX_TRIES) {
|
while (!goodStore && tries < MAX_TRIES) {
|
||||||
tries++;
|
tries++;
|
||||||
if (conn == null || badConn) {
|
if (conn == null) {
|
||||||
try {
|
try {
|
||||||
conn = new SDBConnection(bds.getConnection());
|
conn = new SDBConnection(bds.getConnection());
|
||||||
badConn = false;
|
|
||||||
} catch (SQLException sqle) {
|
} catch (SQLException sqle) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Unable to get SQL connection", sqle);
|
"Unable to get SQL connection", sqle);
|
||||||
|
@ -115,13 +113,15 @@ public class VitroJenaSDBModelMaker implements ModelMaker {
|
||||||
store.getTableFormatter().truncate();
|
store.getTableFormatter().truncate();
|
||||||
}
|
}
|
||||||
} catch (SQLException sqle) {
|
} catch (SQLException sqle) {
|
||||||
|
conn.close();
|
||||||
|
conn = null;
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Unable to set up SDB store for model maker", sqle);
|
"Unable to set up SDB store for model maker", sqle);
|
||||||
}
|
}
|
||||||
if (!isWorking(store)) {
|
if (!isWorking(store)) {
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
conn.close();
|
conn.close();
|
||||||
badConn = true;
|
conn = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue