This commit is contained in:
Keith Donald
2009-04-14 21:09:39 +00:00
parent ff46aea71c
commit 57e0eccf54
3 changed files with 16 additions and 9 deletions

View File

@@ -132,17 +132,27 @@ public class DefaultFlowExecutionRepository extends AbstractSnapshottingFlowExec
public void updateFlowExecutionSnapshot(FlowExecution execution) {
FlowExecutionKey key = execution.getKey();
if (key == null) {
return;
}
Conversation conversation = getConversation(key);
getSnapshotGroup(conversation).updateSnapshot(getSnapshotId(key), snapshot(execution));
}
public void removeFlowExecutionSnapshot(FlowExecution execution) {
FlowExecutionKey key = execution.getKey();
if (key == null) {
return;
}
Conversation conversation = getConversation(key);
getSnapshotGroup(conversation).removeSnapshot(getSnapshotId(key));
}
public void removeAllFlowExecutionSnapshots(FlowExecution execution) {
FlowExecutionKey key = execution.getKey();
if (key == null) {
return;
}
Conversation conversation = getConversation(execution.getKey());
getSnapshotGroup(conversation).removeAllSnapshots();
}

View File

@@ -30,22 +30,20 @@ public interface FlowExecutionSnapshotGroup {
public void addSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot);
/**
* Update the snapshot with the given id.
* Update the snapshot with the given id. Does nothing if no snapshot has been added with the id provided.
* @param snapshotId the snapshot id
* @param snapshot the new snapshot
* @throws SnapshotNotFoundException if there was no previous snapshot to update
*/
public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot)
throws SnapshotNotFoundException;
public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot);
/**
* Remove the snapshot with the given id.
* Remove the snapshot with the given id. Does nothing if no snapshot has been added with the id provided.
* @param snapshotId the continuation id
*/
public void removeSnapshot(Serializable snapshotId);
/**
* Remove all snapshots in this group.
* Remove all snapshots in this group. Does nothing if no snapshots have been added to this group.
*/
public void removeAllSnapshots();

View File

@@ -87,10 +87,9 @@ class SimpleFlowExecutionSnapshotGroup implements FlowExecutionSnapshotGroup, Se
}
}
public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot)
throws SnapshotNotFoundException {
public void updateSnapshot(Serializable snapshotId, FlowExecutionSnapshot snapshot) {
if (!snapshots.containsKey(snapshotId)) {
throw new SnapshotNotFoundException(snapshotId);
return;
}
snapshots.put(snapshotId, snapshot);
}