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 com.google.common.base.MoreObjects;
11 import com.google.common.base.Preconditions;
12 import com.google.common.util.concurrent.Futures;
13 import com.google.common.util.concurrent.ListenableFuture;
14 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
15 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
18 * Base class for internal {@link DOMStoreThreePhaseCommitCohort} implementation. It contains utility constants for
21 * @author Robert Varga
23 abstract class AbstractTransactionCommitCohort implements DOMStoreThreePhaseCommitCohort {
24 static final ListenableFuture<Boolean> TRUE_FUTURE = Futures.immediateFuture(Boolean.TRUE);
25 static final ListenableFuture<Void> VOID_FUTURE = Futures.immediateFuture(null);
27 private final AbstractClientHistory parent;
28 private final TransactionIdentifier txId;
30 AbstractTransactionCommitCohort(final AbstractClientHistory parent, final TransactionIdentifier txId) {
31 this.parent = Preconditions.checkNotNull(parent);
32 this.txId = Preconditions.checkNotNull(txId);
35 final void complete() {
36 parent.onTransactionComplete(txId);
40 public final String toString() {
41 return MoreObjects.toStringHelper(this).add("txId", txId).toString();