2 * Copyright (c) 2016 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.cluster.databroker.actors.dds;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14 import org.opendaylight.mdsal.common.api.CommitInfo;
15 import org.opendaylight.yangtools.yang.common.Empty;
18 * An {@link AbstractTransactionCommitCohort} implementation for transactions which contain a single proxy. Since there
21 * @author Robert Varga
23 final class DirectTransactionCommitCohort extends AbstractTransactionCommitCohort {
24 private final AbstractProxyTransaction proxy;
26 DirectTransactionCommitCohort(final AbstractClientHistory parent, final TransactionIdentifier txId,
27 final AbstractProxyTransaction proxy) {
29 this.proxy = requireNonNull(proxy);
33 public ListenableFuture<Boolean> canCommit() {
34 return proxy.directCommit();
38 public ListenableFuture<Empty> preCommit() {
43 public ListenableFuture<Empty> abort() {
49 public ListenableFuture<CommitInfo> commit() {
51 return CommitInfo.emptyFluentFuture();