Add new cds-access-api proxies
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / TransactionCommitSuccess.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 java.io.ObjectInput;
11 import org.opendaylight.controller.cluster.access.ABIVersion;
12 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
13
14 /**
15  * Successful reply to a coordinated commit request. It contains a reference to the actor which is handling the commit
16  * process.
17  *
18  * @author Robert Varga
19  */
20 public final class TransactionCommitSuccess extends TransactionSuccess<TransactionCommitSuccess> {
21     interface SerialForm extends TransactionSuccess.SerialForm<TransactionCommitSuccess> {
22         @Override
23         default TransactionCommitSuccess readExternal(final ObjectInput in, final TransactionIdentifier target,
24                 final long sequence) {
25             return new TransactionCommitSuccess(target, sequence);
26         }
27     }
28
29     @java.io.Serial
30     private static final long serialVersionUID = 1L;
31
32     private TransactionCommitSuccess(final TransactionCommitSuccess success, final ABIVersion version) {
33         super(success, version);
34     }
35
36     public TransactionCommitSuccess(final TransactionIdentifier identifier, final long sequence) {
37         super(identifier, sequence);
38     }
39
40     @Override
41     protected SerialForm externalizableProxy(final ABIVersion version) {
42         return ABIVersion.MAGNESIUM.lt(version) ? new TCS(this) : new TransactionCommitSuccessProxyV1(this);
43     }
44
45     @Override
46     protected TransactionCommitSuccess cloneAsVersion(final ABIVersion version) {
47         return new TransactionCommitSuccess(this, version);
48     }
49 }