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
8 package org.opendaylight.controller.cluster.datastore.messages;
10 import static com.google.common.base.Preconditions.checkArgument;
11 import static java.util.Objects.requireNonNull;
13 import java.io.IOException;
14 import java.io.ObjectInput;
15 import java.io.ObjectOutput;
16 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
17 import org.opendaylight.yangtools.concepts.Identifiable;
19 public class CloseTransactionChain extends VersionedExternalizableMessage
20 implements Identifiable<LocalHistoryIdentifier> {
21 private static final long serialVersionUID = 1L;
23 private LocalHistoryIdentifier transactionChainId;
25 public CloseTransactionChain() {
28 public CloseTransactionChain(final LocalHistoryIdentifier transactionChainId, final short version) {
30 this.transactionChainId = requireNonNull(transactionChainId);
34 public LocalHistoryIdentifier getIdentifier() {
35 return transactionChainId;
39 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
40 super.readExternal(in);
41 transactionChainId = LocalHistoryIdentifier.readFrom(in);
45 public void writeExternal(final ObjectOutput out) throws IOException {
46 super.writeExternal(out);
47 transactionChainId.writeTo(out);
50 public static CloseTransactionChain fromSerializable(final Object serializable) {
51 checkArgument(serializable instanceof CloseTransactionChain);
52 return (CloseTransactionChain)serializable;
55 public static boolean isSerializedType(final Object message) {
56 return message instanceof CloseTransactionChain;