Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / ReadDataReply.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 package org.opendaylight.controller.cluster.datastore.messages;
9
10 import java.io.IOException;
11 import java.io.ObjectInput;
12 import java.io.ObjectOutput;
13 import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15
16 @Deprecated(since = "9.0.0", forRemoval = true)
17 public class ReadDataReply extends VersionedExternalizableMessage {
18     private static final long serialVersionUID = 1L;
19
20     private NormalizedNode normalizedNode;
21
22     public ReadDataReply() {
23     }
24
25     public ReadDataReply(final NormalizedNode normalizedNode, final short version) {
26         super(version);
27         this.normalizedNode = normalizedNode;
28     }
29
30     public NormalizedNode getNormalizedNode() {
31         return normalizedNode;
32     }
33
34     @Override
35     public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
36         super.readExternal(in);
37         normalizedNode = SerializationUtils.readNormalizedNode(in).orElse(null);
38     }
39
40     @Override
41     public void writeExternal(final ObjectOutput out) throws IOException {
42         super.writeExternal(out);
43         SerializationUtils.writeNormalizedNode(out, getStreamVersion(), normalizedNode);
44     }
45
46     public static ReadDataReply fromSerializable(final Object serializable) {
47         return (ReadDataReply) serializable;
48     }
49
50     public static boolean isSerializedType(final Object message) {
51         return message instanceof ReadDataReply;
52     }
53 }