BUG-5280: introduce base Transaction request/success
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / AbortLocalTransactionRequest.java
1 /*
2  * Copyright (c) 2016 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 package org.opendaylight.controller.cluster.access.commands;
9
10 import akka.actor.ActorRef;
11 import com.google.common.annotations.Beta;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14
15 /**
16  * Request to abort a local transaction. Since local transactions do not introduce state on the backend until they
17  * are ready, the purpose of this message is to inform the backend that a message identifier has been used. This is
18  * not important for single transactions, but is critical to ensure transaction ordering within local histories.
19  *
20  * @author Robert Varga
21  */
22 @Beta
23 public final class AbortLocalTransactionRequest extends AbstractLocalTransactionRequest<AbortLocalTransactionRequest> {
24     private static final long serialVersionUID = 1L;
25
26     public AbortLocalTransactionRequest(final @Nonnull TransactionIdentifier identifier, final long sequence,
27             final @Nonnull ActorRef replyTo) {
28         this(identifier, sequence, 0, replyTo);
29     }
30
31     AbortLocalTransactionRequest(final @Nonnull TransactionIdentifier identifier, final long sequence,
32             final long retry, final @Nonnull ActorRef replyTo) {
33         super(identifier, sequence, retry, replyTo);
34     }
35
36     private AbortLocalTransactionRequest(final @Nonnull AbortLocalTransactionRequest request, final long retry) {
37         super(request, retry);
38     }
39
40     @Override
41     protected AbortLocalTransactionRequest cloneAsRetry(final long retry) {
42         return new AbortLocalTransactionRequest(this, retry);
43     }
44 }