2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.md.sal.dom.broker.impl;
10 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
11 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
12 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
13 import org.opendaylight.yangtools.yang.common.RpcResult;
15 import com.google.common.base.Optional;
16 import com.google.common.util.concurrent.ListenableFuture;
19 * Executor of Three Phase Commit coordination for
20 * {@link DOMDataWriteTransaction} transactions.
22 * Implementations are responsible for executing implementation of three-phase
23 * commit protocol on supplied {@link DOMStoreThreePhaseCommitCohort}s.
27 interface DOMDataCommitExecutor {
30 * Submits supplied transaction to be executed in context of provided
33 * Transaction is used only as a context, cohorts should be associated with
37 * Transaction to be used as context for reporting
39 * DOM Store cohorts representing provided transaction, its
42 * Error listener which should be notified if transaction failed.
43 * @return ListenableFuture which contains RpcResult with
44 * {@link TransactionStatus#COMMITED} if commit coordination on
45 * cohorts finished successfully.
48 ListenableFuture<RpcResult<TransactionStatus>> submit(DOMDataWriteTransaction tx,
49 Iterable<DOMStoreThreePhaseCommitCohort> cohort, Optional<DOMDataCommitErrorListener> listener);