InMemoryDOMDataStore$DOMStoreTransactionChainImpl isnt happy if there are mulitple... 16/10816/1
authorMadhu Venugopal <mavenugo@gmail.com>
Thu, 4 Sep 2014 23:13:10 +0000 (16:13 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Thu, 4 Sep 2014 23:13:10 +0000 (16:13 -0700)
And it throws
java.lang.IllegalStateException: Previous transaction in chain must be ready.
at com.google.common.base.Preconditions.checkState(Preconditions.java:149) ~[na:na]
at org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore$DOMStoreTransactionChainImpl.newReadWriteTransaction

when we reuse the txchain. Fixing it temporarily. Better solution is to get away from this and use DataChangeListener.

Change-Id: Id20abdefc21574dce9ff078f4ce96aa91c390edb
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/AbstractServiceInstance.java

index 934f763bf4d790be89d1750c451b39a35b28a330..5c071454abac97cbae7f4ff2990a3f8ca03e185e 100644 (file)
@@ -81,8 +81,6 @@ public abstract class AbstractServiceInstance implements OpendaylightInventoryLi
     // Concrete Service that this AbstractServiceInstance represent
     private Service service;
 
-    private BindingTransactionChain txChain;
-
     // Process Notification in its own thread
     Thread thread = null;
     private final BlockingQueue<String> queue = new LinkedBlockingDeque<>();
@@ -112,7 +110,6 @@ public abstract class AbstractServiceInstance implements OpendaylightInventoryLi
         if (notificationService != null) {
             notificationService.registerNotificationListener(this);
         }
-        this.txChain =  mdsalConsumer.getDataBroker().createTransactionChain(this);
 
         // Never block a Notification thread. Process the notification in its own Thread.
         thread = new Thread(this);
@@ -340,6 +337,7 @@ public abstract class AbstractServiceInstance implements OpendaylightInventoryLi
             InstanceIdentifierBuilder<Node> builder = ((InstanceIdentifier<Node>) ref.getValue()).builder();
             InstanceIdentifierBuilder<FlowCapableNode> augmentation = builder.augmentation(FlowCapableNode.class);
             final InstanceIdentifier<FlowCapableNode> path = augmentation.build();
+            BindingTransactionChain txChain = mdsalConsumer.getDataBroker().createTransactionChain(this);
             CheckedFuture readFuture = txChain.newReadWriteTransaction().read(LogicalDatastoreType.OPERATIONAL, path);
             Futures.addCallback(readFuture, new FutureCallback<Optional<? extends DataObject>>() {
                 @Override