mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-29 07:11:49 +01:00
ONOS-7007 fix parent test using wrong path
Change-Id: I666d038e3d2e33686941a99cd04a61496726f5da
This commit is contained in:
parent
30161e7abe
commit
ff9af3e5eb
@ -107,11 +107,16 @@ public class PartitionedAsyncDocumentTree<V> implements AsyncDocumentTree<V> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Boolean> create(DocumentPath path, V value) {
|
public CompletableFuture<Boolean> create(DocumentPath path, V value) {
|
||||||
|
if (path.parent() == null) {
|
||||||
|
// create value on root
|
||||||
|
return partition(path).createRecursive(path, value);
|
||||||
|
}
|
||||||
// TODO: This operation is not atomic
|
// TODO: This operation is not atomic
|
||||||
return partition(path.parent()).get(path).thenCompose(parentValue -> {
|
return partition(path.parent()).get(path.parent()).thenCompose(parentValue -> {
|
||||||
if (parentValue == null) {
|
if (parentValue == null) {
|
||||||
return Tools.exceptionalFuture(new NoSuchDocumentPathException(String.valueOf(path.parent())));
|
return Tools.exceptionalFuture(new NoSuchDocumentPathException(String.valueOf(path.parent())));
|
||||||
} else {
|
} else {
|
||||||
|
// not atomic: parent did exist at some point, so moving forward
|
||||||
return partition(path).createRecursive(path, value);
|
return partition(path).createRecursive(path, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user