Delay snapshot backed transaction ready error
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / DOMStoreTransactionChainImpl.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 org.opendaylight.controller.sal.core.spi.data.AbstractSnapshotBackedTransactionChain;
12 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
13 import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
16
17 final class DOMStoreTransactionChainImpl extends AbstractSnapshotBackedTransactionChain<String> {
18     private final InMemoryDOMDataStore store;
19
20     DOMStoreTransactionChainImpl(final InMemoryDOMDataStore store) {
21         this.store = Preconditions.checkNotNull(store);
22     }
23
24     @Override
25     protected DOMStoreThreePhaseCommitCohort createCohort(final SnapshotBackedWriteTransaction<String> tx,
26                                                           final DataTreeModification modification,
27                                                           final Exception operationError) {
28         return new ChainedTransactionCommitImpl(store, tx, modification, this, operationError);
29     }
30
31     @Override
32     protected DataTreeSnapshot takeSnapshot() {
33         return store.takeSnapshot();
34     }
35
36     @Override
37     protected String nextTransactionIdentifier() {
38         return store.nextIdentifier();
39     }
40
41     @Override
42     protected boolean getDebugTransactions() {
43         return store.getDebugTransactions();
44     }
45
46     void transactionCommited(final SnapshotBackedWriteTransaction<String> transaction) {
47         super.onTransactionCommited(transaction);
48     }
49 }