BUG-7033: Fix commit exception due to pipe-lining
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / AbstractShardedTransaction.java
1 /*
2  * Copyright (c) 2016 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.cluster.databroker;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
12 import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransaction;
13
14 /**
15  * Abstract base class for concrete {@link DOMStoreTransaction} implementations. It holds a reference to the associated
16  * {@link ClientTransaction}. This abstraction layer is needed to isolate end users, who interact with
17  * {@link DOMStoreTransaction} from the internal implementation.
18  *
19  * @author Robert Varga
20  */
21 abstract class AbstractShardedTransaction implements DOMStoreTransaction {
22     private final ClientTransaction tx;
23
24     AbstractShardedTransaction(final ClientTransaction tx) {
25         this.tx = Preconditions.checkNotNull(tx);
26     }
27
28     @Override
29     public final Object getIdentifier() {
30         return tx.getIdentifier();
31     }
32
33     final ClientTransaction transaction() {
34         return tx;
35     }
36 }