Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bug 8336 - Fix NPE in DistributedShardedDOMDataTree's ProxyProducer
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
sharding
/
DistributedShardedDOMDataTree.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTree.java
b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTree.java
index 506498ce9a77fecbf9d7911296aafb49c1160f11..564fb978bee42cc41c4f87c2fa8f03a94fb0c57d 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTree.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTree.java
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2016
, 2017
Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@
-402,7
+402,7
@@
public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
prefix.getDatastoreType().equals(org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION)
? distributedConfigDatastore : distributedOperDatastore;
prefix.getDatastoreType().equals(org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION)
? distributedConfigDatastore : distributedOperDatastore;
- try (
final
DOMDataTreeProducer producer = localCreateProducer(Collections.singletonList(prefix))) {
+ try (DOMDataTreeProducer producer = localCreateProducer(Collections.singletonList(prefix))) {
final Entry<DataStoreClient, ActorRef> entry =
createDatastoreClient(shardName, distributedDataStore.getActorContext());
final Entry<DataStoreClient, ActorRef> entry =
createDatastoreClient(shardName, distributedDataStore.getActorContext());
@@
-464,8
+464,9
@@
public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
DOMDataTreePrefixTableEntry<DOMDataTreeShardRegistration<DOMDataTreeShard>> lookupShardFrontend(
final DOMDataTreeIdentifier prefix) {
DOMDataTreePrefixTableEntry<DOMDataTreeShardRegistration<DOMDataTreeShard>> lookupShardFrontend(
final DOMDataTreeIdentifier prefix) {
- return shards.lookup(prefix);
-
+ synchronized (shards) {
+ return shards.lookup(prefix);
+ }
}
DOMDataTreeProducer localCreateProducer(final Collection<DOMDataTreeIdentifier> prefix) {
}
DOMDataTreeProducer localCreateProducer(final Collection<DOMDataTreeIdentifier> prefix) {
@@
-675,7
+676,7
@@
public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
final Object o = actorContext.executeOperation(shardDataTreeActor, new ProducerRemoved(subtrees));
if (o instanceof DOMDataTreeProducerException) {
final Object o = actorContext.executeOperation(shardDataTreeActor, new ProducerRemoved(subtrees));
if (o instanceof DOMDataTreeProducerException) {
- throw (
(DOMDataTreeProducerException) o)
;
+ throw (
DOMDataTreeProducerException) o
;
} else if (o instanceof Throwable) {
throw new DOMDataTreeProducerException("Unable to close producer", (Throwable) o);
}
} else if (o instanceof Throwable) {
throw new DOMDataTreeProducerException("Unable to close producer", (Throwable) o);
}
@@
-701,7
+702,8
@@
public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
// producer attached to some subtree at a time. And also how we can close ShardAccess
// then
final CDSShardAccessImpl shardAccess = new CDSShardAccessImpl(subtree, actorContext);
// producer attached to some subtree at a time. And also how we can close ShardAccess
// then
final CDSShardAccessImpl shardAccess = new CDSShardAccessImpl(subtree, actorContext);
- return shardAccessMap.put(subtree, shardAccess);
+ shardAccessMap.put(subtree, shardAccess);
+ return shardAccess;
}
}
}
}
}
}