c3c9589ff0ce21efe2d174b7ab82720709bd2f24
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / ChainedTransactionCommitImpl.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.mdsal.dom.store.inmemory;
9
10 import com.google.common.base.Preconditions;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.mdsal.dom.spi.store.SnapshotBackedWriteTransaction;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
14
15 final class ChainedTransactionCommitImpl extends InMemoryDOMStoreThreePhaseCommitCohort {
16     private final DOMStoreTransactionChainImpl txChain;
17
18     ChainedTransactionCommitImpl(final InMemoryDOMDataStore store,
19         final SnapshotBackedWriteTransaction<String> transaction,final DataTreeModification modification,
20             final DOMStoreTransactionChainImpl txChain) {
21         super(store, transaction, modification);
22         this.txChain = Preconditions.checkNotNull(txChain);
23     }
24
25     @Override
26     public ListenableFuture<Void> commit() {
27         ListenableFuture<Void> ret = super.commit();
28         txChain.transactionCommited(getTransaction());
29         return ret;
30     }
31
32 }