Bug 1763: Fixed illegal state in Binding Transaction Chain. 33/10933/1
authorTony Tkacik <ttkacik@cisco.com>
Tue, 9 Sep 2014 07:28:33 +0000 (09:28 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Tue, 9 Sep 2014 07:28:38 +0000 (09:28 +0200)
Naming in BindingTransactionChain, which operates
with user supplied Binding Transaction Chain listener
and chain's own DOM TransactionChain led to invalid
substition of this two, which caused IllegalStateException
when chain failed.

Change-Id: I2a40cd2c200f0b9b7149908f05d84685891c71ea
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingTranslatedTransactionChain.java

index 73c81ca3a343b21cc4b879163e9b69fdeb385693..36b7a0f5f2754cd54be26bd932c99e6e361a9631 100644 (file)
@@ -34,15 +34,15 @@ final class BindingTranslatedTransactionChain implements BindingTransactionChain
 
     private final DOMTransactionChain delegate;
     private final BindingToNormalizedNodeCodec codec;
 
     private final DOMTransactionChain delegate;
     private final BindingToNormalizedNodeCodec codec;
-    private final DelegateChainListener delegatingListener;
-    private final TransactionChainListener listener;
+    private final DelegateChainListener domListener;
+    private final TransactionChainListener bindingListener;
 
     public BindingTranslatedTransactionChain(final DOMDataBroker chainFactory,
             final BindingToNormalizedNodeCodec codec, final TransactionChainListener listener) {
         Preconditions.checkNotNull(chainFactory, "DOM Transaction chain factory must not be null");
 
     public BindingTranslatedTransactionChain(final DOMDataBroker chainFactory,
             final BindingToNormalizedNodeCodec codec, final TransactionChainListener listener) {
         Preconditions.checkNotNull(chainFactory, "DOM Transaction chain factory must not be null");
-        this.delegatingListener = new DelegateChainListener();
-        this.listener = listener;
-        this.delegate = chainFactory.createTransactionChain(listener);
+        this.domListener = new DelegateChainListener();
+        this.bindingListener = listener;
+        this.delegate = chainFactory.createTransactionChain(domListener);
         this.codec = codec;
     }
 
         this.codec = codec;
     }
 
@@ -110,7 +110,7 @@ final class BindingTranslatedTransactionChain implements BindingTransactionChain
          * chain, so we are not changing any of our internal state
          * to mark that we failed.
          */
          * chain, so we are not changing any of our internal state
          * to mark that we failed.
          */
-        this.delegatingListener.onTransactionChainFailed(this, tx, t);
+        this.bindingListener.onTransactionChainFailed(this, tx, t);
     }
 
     @Override
     }
 
     @Override
@@ -141,7 +141,7 @@ final class BindingTranslatedTransactionChain implements BindingTransactionChain
         public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
             Preconditions.checkState(delegate.equals(chain),
                     "Illegal state - listener for %s was invoked for incorrect chain %s.", delegate, chain);
         public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
             Preconditions.checkState(delegate.equals(chain),
                     "Illegal state - listener for %s was invoked for incorrect chain %s.", delegate, chain);
-            listener.onTransactionChainSuccessful(BindingTranslatedTransactionChain.this);
+            bindingListener.onTransactionChainSuccessful(BindingTranslatedTransactionChain.this);
         }
     }
 
         }
     }