Fixed Checkstyle violation errors in mdsal-common-api
[mdsal.git] / common / mdsal-common-api / src / main / java / org / opendaylight / mdsal / common / api / ThreePhaseCommitStep.java
1 /*
2  * Copyright (c) 2015 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
9 package org.opendaylight.mdsal.common.api;
10
11 import com.google.common.annotations.Beta;
12 import com.google.common.util.concurrent.Futures;
13 import com.google.common.util.concurrent.ListenableFuture;
14 import javax.annotation.Nonnull;
15
16 /**
17  * Common interface for implementing three-phase commit steps.
18  * Actual steps to be implemented are: {@link PostCanCommitStep} and {@link PostPreCommitStep} which
19  * allows to customize pre-commit, commit and abort actions.
20  *
21  */
22 @Beta
23 public interface ThreePhaseCommitStep {
24
25     ListenableFuture<?> NOOP_ABORT_FUTURE = Futures.immediateFuture(null);
26
27     /**
28      * Invoked on transaction aborted.
29      * This callback is invoked by three-phase commit coordinator if associated data transaction
30      * will not be commited and is being aborted.
31      * Implementation MUST rollback any changes, which were introduced by implementation based on
32      * supplied data.
33      *
34      * @return ListenableFuture which will complete once abort is completed.
35      */
36     @Nonnull
37     ListenableFuture<?> abort();
38 }