IMDS: trim down commit overhead
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / 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.controller.md.sal.dom.store.impl;
9
10 import com.google.common.base.Preconditions;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.controller.sal.core.spi.data.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, final SnapshotBackedWriteTransaction<String> transaction,
19         final DataTreeModification modification, final DOMStoreTransactionChainImpl txChain) {
20         super(store, transaction, modification);
21         this.txChain = Preconditions.checkNotNull(txChain);
22     }
23
24     @Override
25     public ListenableFuture<Void> commit() {
26         ListenableFuture<Void> ret = super.commit();
27         txChain.transactionCommited(getTransaction());
28         return ret;
29     }
30
31 }