2 * Copyright (c) 2016 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.access.commands;
10 import akka.actor.ActorRef;
11 import java.io.IOException;
12 import java.io.ObjectInput;
13 import java.io.ObjectOutput;
14 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
17 * Abstract base class for serialization proxies associated with {@link AbstractReadTransactionRequest}s. It implements
18 * the initial (Boron) serialization format.
20 * @author Robert Varga
22 * @param <T> Message type
24 abstract class AbstractReadTransactionRequestProxyV1<T extends AbstractReadTransactionRequest<T>>
25 extends AbstractTransactionRequestProxy<T> {
26 private static final long serialVersionUID = 1L;
27 private boolean snapshotOnly;
29 protected AbstractReadTransactionRequestProxyV1() {
33 AbstractReadTransactionRequestProxyV1(final T request) {
35 snapshotOnly = request.isSnapshotOnly();
39 public void writeExternal(final ObjectOutput out) throws IOException {
40 super.writeExternal(out);
41 out.writeBoolean(snapshotOnly);
45 public void readExternal(final ObjectInput in) throws ClassNotFoundException, IOException {
46 super.readExternal(in);
47 snapshotOnly = in.readBoolean();
51 protected final T createRequest(final TransactionIdentifier target, final long sequence, final ActorRef replyTo) {
52 return createReadRequest(target, sequence, replyTo, snapshotOnly);
55 abstract T createReadRequest(TransactionIdentifier target, long sequence, ActorRef replyTo, boolean snapshotOnly);