2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.cluster.datastore.messages;
11 import com.google.common.base.Preconditions;
12 import java.io.IOException;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
15 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
16 import org.opendaylight.yangtools.concepts.Identifiable;
18 public class CloseTransactionChain extends VersionedExternalizableMessage implements Identifiable<LocalHistoryIdentifier> {
19 private static final long serialVersionUID = 1L;
21 private LocalHistoryIdentifier transactionChainId;
23 public CloseTransactionChain() {
26 public CloseTransactionChain(final LocalHistoryIdentifier transactionChainId, final short version) {
28 this.transactionChainId = Preconditions.checkNotNull(transactionChainId);
32 public LocalHistoryIdentifier getIdentifier() {
33 return transactionChainId;
37 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
38 super.readExternal(in);
39 transactionChainId = LocalHistoryIdentifier.readFrom(in);
43 public void writeExternal(ObjectOutput out) throws IOException {
44 super.writeExternal(out);
45 transactionChainId.writeTo(out);
48 public static CloseTransactionChain fromSerializable(final Object serializable){
49 Preconditions.checkArgument(serializable instanceof CloseTransactionChain);
50 return (CloseTransactionChain)serializable;
53 public static boolean isSerializedType(Object message) {
54 return message instanceof CloseTransactionChain;