mainProgram.mutex.release();
}
} catch (IllegalAcornStateException | ProCoreException e) {
- Logger.defaultLogError(e);
+ Logger.defaultLogError("Snapshotting failed", e);
unexpectedClose = true;
} catch (InterruptedException e) {
- Logger.defaultLogError(e);
+ Logger.defaultLogError("Snapshotting interrupted", e);
} finally {
try {
if(tr != null)
try {
support.close();
} catch (DatabaseException e1) {
- Logger.defaultLogError(e1);
+ Logger.defaultLogError("Failed to close database as a safety measure due to failed snapshotting", e1);
}
}
} catch (ProCoreException e) {
- Logger.defaultLogError(e);
+ Logger.defaultLogError("Failed to end snapshotting write transaction", e);
}
}
}
@Override
public long cancelCommit(long transactionId, long changeSetId, byte[] metadata, OnChangeSetUpdate onChangeSetUpdate) throws ProCoreException {
- UnsupportedOperationException e = new UnsupportedOperationException("org.simantics.acorn.GraphClientImpl2.cancelCommit() is not supported operation! Closing down to prevent further havoc");
- clusters.notSafeToMakeSnapshot(new IllegalAcornStateException(e));
- throw e;
-// 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;
+ // Accept and finalize current transaction and then undo it
+ acceptCommit(transactionId, changeSetId, metadata);
+
+ try {
+ undo(new long[] {changeSetId+1}, onChangeSetUpdate);
+ clusters.state.headChangeSetId++;
+ return clusters.state.headChangeSetId;
+ } catch (SDBException e) {
+ Logger.defaultLogError("Failed to undo cancelled transaction", e);
+ throw new ProCoreException(e);
+ }
}
@Override
ArrayList<String> ccss = clusters.getChanges(id);
for(int j=0;j<ccss.size();j++) {
+ String ccsid = ccss.get(ccss.size()-j-1);
try {
if(ClusterUpdateProcessorBase.DEBUG)
- System.err.println("performUndo " + ccss.get(ccss.size()-j-1));
- performUndo(ccss.get(ccss.size()-j-1), clusterChanges, support);
+ System.err.println("performUndo " + ccsid);
+ performUndo(ccsid, clusterChanges, support);
} catch (DatabaseException e) {
e.printStackTrace();
}