Skip to content

Commit

Permalink
Merge pull request #263 from 3-Round-Stones/graph-store-transactions
Browse files Browse the repository at this point in the history
Fix #262 Add transaction around graph store operations
  • Loading branch information
catch-point authored Aug 23, 2016
2 parents 2c3618d + 5ffbf31 commit d24a99f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/org/callimachusproject/behaviours/DatasourceSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ protected HttpResponse executeUpdate(String[] defaultGraphs,
int skipped = buffer(bin, MAX_RU_SIZE);
String base = loc == null ? this.getResource().stringValue() : loc;
final RepositoryConnection con = openConnection();
boolean rollback = true;
con.begin();
try {
if (MAX_RU_SIZE > skipped) {
byte[] buf = new byte[skipped];
Expand Down Expand Up @@ -237,8 +239,13 @@ public int getStatusCode() {
}
};
}
con.commit();
rollback = false;
return new BasicHttpResponse(HttpVersion.HTTP_1_1, 204, "No Content");
} finally {
if (rollback) {
con.rollback();
}
con.close();
}
}
Expand Down

0 comments on commit d24a99f

Please sign in to comment.