Merge "Fixed for bug 1168 : Issue while update subnet"
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / DOMDataCommitExecutor.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.broker.impl;
9
10 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
11 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
12 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
13 import com.google.common.base.Optional;
14 import com.google.common.util.concurrent.CheckedFuture;
15
16 /**
17  * Executor of Three Phase Commit coordination for
18  * {@link DOMDataWriteTransaction} transactions.
19  *
20  * Implementations are responsible for executing implementation of three-phase
21  * commit protocol on supplied {@link DOMStoreThreePhaseCommitCohort}s.
22  *
23  *
24  */
25 interface DOMDataCommitExecutor {
26
27     /**
28      * Submits supplied transaction to be executed in context of provided
29      * cohorts.
30      *
31      * Transaction is used only as a context, cohorts should be associated with
32      * this transaction.
33      *
34      * @param tx
35      *            Transaction to be used as context for reporting
36      * @param cohort
37      *            DOM Store cohorts representing provided transaction, its
38      *            subtransactoins.
39      * @param listener
40      *            Error listener which should be notified if transaction failed.
41      * @return a CheckedFuture. if commit coordination on cohorts finished successfully,
42      *         nothing is returned from the Future, On failure,
43      *         the Future fails with a {@link TransactionCommitFailedException}.
44      *
45      */
46     CheckedFuture<Void,TransactionCommitFailedException> submit(DOMDataWriteTransaction tx,
47             Iterable<DOMStoreThreePhaseCommitCohort> cohort, Optional<DOMDataCommitErrorListener> listener);
48
49 }