}
public void makeSnapshot(boolean force) throws IOException {
- clusters.makeSnapshot(locator, force);
+ if (safeToMakeSnapshot)
+ clusters.makeSnapshot(locator, force);
}
public <T> T clone(ClusterUID uid, ClusterCreator creator) throws DatabaseException {
private boolean closed = false;
private boolean isClosing = false;
+ // Add check to make sure if it safe to make snapshot (used with cancel which is not yet supported and may cause corrupted head.state writing)
+ private boolean safeToMakeSnapshot = true;
@Override
public void close() throws ProCoreException {
if(!closed && !isClosing) {
isClosing = true;
try {
- makeSnapshot(true);
+ makeSnapshot(true);
mainProgram.close();
clusters.shutdown();
public long cancelCommit(long transactionId, long changeSetId,
byte[] metadata, OnChangeSetUpdate onChangeSetUpdate)
throws ProCoreException {
- System.err.println("GraphClientImpl2.cancelCommit() called!! this is experimental and might cause havoc!");
- try {
- undo(new long[] {changeSetId}, onChangeSetUpdate);
- } catch (SDBException e) {
- e.printStackTrace();
- throw new ProCoreException(e);
- }
- clusters.state.headChangeSetId++;
- return clusters.state.headChangeSetId;
+ safeToMakeSnapshot = false;
+ throw new UnsupportedOperationException("org.simantics.acorn.GraphClientImpl2.cancelCommit() is not supported operation! Closing down to prevent further havoc");
+// System.err.println("GraphClientImpl2.cancelCommit() called!! this is experimental and might cause havoc!");
+// try {
+// undo(new long[] {changeSetId}, onChangeSetUpdate);
+// } catch (SDBException e) {
+// e.printStackTrace();
+// throw new ProCoreException(e);
+// }
+// clusters.state.headChangeSetId++;
+// return clusters.state.headChangeSetId;
}
@Override