BUG-5280: introduce base Transaction request/success
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / TransactionCanCommitSuccess.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.base.Preconditions;
12 import org.opendaylight.controller.cluster.access.ABIVersion;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14
15 /**
16  * Successful reply to a coordinated commit request. It contains a reference to the actor which is handling the commit
17  * process.
18  *
19  * @author Robert Varga
20  */
21 public final class TransactionCanCommitSuccess extends TransactionSuccess<TransactionCanCommitSuccess> {
22     private static final long serialVersionUID = 1L;
23     private final ActorRef cohort;
24
25     public TransactionCanCommitSuccess(final TransactionIdentifier identifier, final long sequence, final long retry,
26             final ActorRef cohort) {
27         super(identifier, sequence, retry);
28         this.cohort = Preconditions.checkNotNull(cohort);
29     }
30
31     public ActorRef getCohort() {
32         return cohort;
33     }
34
35     @Override
36     protected AbstractTransactionSuccessProxy<TransactionCanCommitSuccess> externalizableProxy(final ABIVersion version) {
37         return new TransactionCanCommitSuccessProxyV1(this);
38     }
39
40     @Override
41     protected TransactionCanCommitSuccess cloneAsVersion(final ABIVersion version) {
42         return this;
43     }
44 }