2 * Copyright (c) 2015 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.mdsal.common.api;
10 import com.google.common.annotations.Beta;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
16 * Common interface for implementing three-phase commit steps.
17 * Actual steps to be implemented are: {@link PostCanCommitStep} and {@link PostPreCommitStep} which
18 * allows to customize pre-commit, commit and abort actions.
22 public interface ThreePhaseCommitStep {
23 @NonNull ListenableFuture<?> NOOP_ABORT_FUTURE = FluentFutures.immediateNullFluentFuture();
26 * Invoked on transaction aborted.
27 * This callback is invoked by three-phase commit coordinator if associated data transaction
28 * will not be commited and is being aborted.
29 * Implementation MUST rollback any changes, which were introduced by implementation based on
32 * @return ListenableFuture which will complete once abort is completed.
34 @NonNull ListenableFuture<?> abort();