Merge "Fixed typo in SnapshotBackedWriteTransaction class"
authorTony Tkacik <ttkacik@cisco.com>
Wed, 7 May 2014 11:14:00 +0000 (11:14 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 7 May 2014 11:14:00 +0000 (11:14 +0000)
1  2 
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java

index 9bbba1e24d8600f196f23df145105d1b787e9c6e,de674eb71e167fe7feae7934e7560fb32d7fc554..0a2b66c2d0112a35e4173d11ac8c7e06de1f73c2
@@@ -90,7 -90,7 +90,7 @@@ public class InMemoryDOMDataStore imple
  
      @Override
      public DOMStoreWriteTransaction newWriteOnlyTransaction() {
-         return new SnaphostBackedWriteTransaction(nextIdentifier(), snapshot.get(), this, operationTree);
+         return new SnapshotBackedWriteTransaction(nextIdentifier(), snapshot.get(), this, operationTree);
      }
  
      @Override
      }
  
      private synchronized DOMStoreThreePhaseCommitCohort submit(
-             final SnaphostBackedWriteTransaction writeTx) {
+             final SnapshotBackedWriteTransaction writeTx) {
          LOG.debug("Tx: {} is submitted. Modifications: {}",writeTx.getIdentifier(),writeTx.getMutatedView());
          return new ThreePhaseCommitImpl(writeTx);
      }
          }
      }
  
-     private static class SnaphostBackedWriteTransaction extends AbstractDOMStoreTransaction implements DOMStoreWriteTransaction {
+     private static class SnapshotBackedWriteTransaction extends AbstractDOMStoreTransaction implements DOMStoreWriteTransaction {
          private MutableDataTree mutableTree;
          private InMemoryDOMDataStore store;
          private boolean ready = false;
  
-         public SnaphostBackedWriteTransaction(final Object identifier, final DataAndMetadataSnapshot snapshot,
+         public SnapshotBackedWriteTransaction(final Object identifier, final DataAndMetadataSnapshot snapshot,
                  final InMemoryDOMDataStore store, final ModificationApplyOperation applyOper) {
              super(identifier);
              mutableTree = MutableDataTree.from(snapshot, applyOper);
              }
          }
  
 +        @Override
 +        public void merge(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
 +            checkNotReady();
 +            try {
 +                LOG.trace("Tx: {} Merge: {}:{}",getIdentifier(),path,data);
 +                mutableTree.merge(path, data);
 +              // FIXME: Add checked exception
 +            } catch (Exception e) {
 +                LOG.error("Tx: {}, failed to write {}:{} in {}",getIdentifier(),path,data,mutableTree,e);
 +            }
 +        }
 +
          @Override
          public void delete(final InstanceIdentifier path) {
              checkNotReady();
          }
      }
  
-     private static class SnapshotBackedReadWriteTransaction extends SnaphostBackedWriteTransaction implements
+     private static class SnapshotBackedReadWriteTransaction extends SnapshotBackedWriteTransaction implements
              DOMStoreReadWriteTransaction {
  
          protected SnapshotBackedReadWriteTransaction(final Object identifier, final DataAndMetadataSnapshot snapshot,
  
      private class ThreePhaseCommitImpl implements DOMStoreThreePhaseCommitCohort {
  
-         private final SnaphostBackedWriteTransaction transaction;
+         private final SnapshotBackedWriteTransaction transaction;
          private final NodeModification modification;
  
          private DataAndMetadataSnapshot storeSnapshot;
          private Optional<StoreMetadataNode> proposedSubtree;
          private ResolveDataChangeEventsTask listenerResolver;
  
-         public ThreePhaseCommitImpl(final SnaphostBackedWriteTransaction writeTransaction) {
+         public ThreePhaseCommitImpl(final SnapshotBackedWriteTransaction writeTransaction) {
              this.transaction = writeTransaction;
              this.modification = transaction.getMutatedView().getRootModification();
          }