398f25336f0e0c423861f655052859601f7927fa
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / AbortTransactionReply.java
1 /*
2  * Copyright (c) 2014 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.controller.cluster.datastore.messages;
10
11 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
12 import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
13
14 public class AbortTransactionReply extends VersionedExternalizableMessage {
15     @Deprecated
16     private static final Object SERIALIZED_INSTANCE =
17             ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder().build();
18
19     private static final AbortTransactionReply INSTANCE = new AbortTransactionReply();
20
21     public AbortTransactionReply() {
22     }
23
24     private AbortTransactionReply(short version) {
25         super(version);
26     }
27
28     @Deprecated
29     @Override
30     protected Object newLegacySerializedInstance() {
31         return SERIALIZED_INSTANCE;
32     }
33
34     public static AbortTransactionReply instance(short version) {
35         return version == DataStoreVersions.CURRENT_VERSION ? INSTANCE : new AbortTransactionReply(version);
36     }
37
38     public static boolean isSerializedType(Object message) {
39         return message instanceof AbortTransactionReply ||
40                 message instanceof ThreePhaseCommitCohortMessages.AbortTransactionReply;
41     }
42 }