d542935dd6dbf0fdb91ce72b273d6bc9c87b2668
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / TransactionChain.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.common.api.data;
9
10 import org.opendaylight.yangtools.concepts.Path;
11
12 /**
13  * A chain of transactions. Transactions in a chain need to be committed in sequence and each
14  * transaction should see the effects of previous transactions as if they happened. A chain
15  * makes no guarantees of atomicity, in fact transactions are committed as soon as possible.
16  */
17 public interface TransactionChain<P extends Path<P>, D> extends AutoCloseable {
18     /**
19      * Create a new transaction which will continue the chain. The previous transaction
20      * has to be either COMMITTED or CANCELLED.
21      *
22      * @return New transaction in the chain.
23      * @throws IllegalStateException if the previous transaction was not COMMITTED or CANCELLED.
24      * @throws TransactionChainClosedException if the chain has been closed.
25      */
26     DataModification<P, D> newTransaction();
27
28     @Override
29     void close();
30 }
31

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.