mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-23 13:21:21 +02:00
add comments to DatabaseStateMachine
Change-Id: I775e2f6c0250ac158e301408e423ebdb29d75668
This commit is contained in:
parent
1838f88d2b
commit
bddc81c4ec
@ -89,6 +89,8 @@ public class DatabaseStateMachine implements StateMachine {
|
||||
|
||||
@Command
|
||||
public List<InternalWriteResult> write(List<WriteRequest> requests) {
|
||||
|
||||
// applicability check
|
||||
boolean abort = false;
|
||||
List<InternalWriteResult.Status> validationResults = new ArrayList<>(requests.size());
|
||||
for (WriteRequest request : requests) {
|
||||
@ -132,8 +134,13 @@ public class DatabaseStateMachine implements StateMachine {
|
||||
return results;
|
||||
}
|
||||
|
||||
// apply changes
|
||||
for (WriteRequest request : requests) {
|
||||
Map<String, VersionedValue> table = state.getTables().get(request.tableName());
|
||||
// FIXME: If this method could be called by multiple thread,
|
||||
// synchronization scope is wrong.
|
||||
// Whole function including applicability check needs to be protected.
|
||||
// Confirm copycat's thread safety requirement for StateMachine
|
||||
synchronized (table) {
|
||||
VersionedValue previousValue =
|
||||
table.put(request.key(), new VersionedValue(request.newValue(), state.nextVersion()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user