2 * Copyright (c) 2016, 2017 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 com.google.common.base.MoreObjects.ToStringHelper;
12 import java.io.Serial;
13 import org.opendaylight.controller.cluster.access.ABIVersion;
14 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
17 * Abstract base class for {@link TransactionRequest}s accessing transaction state without modifying it.
20 * This class is visible outside of this package for the purpose of allowing common instanceof checks
21 * and simplified codepaths.
23 * @param <T> Message type
25 public abstract class AbstractReadTransactionRequest<T extends AbstractReadTransactionRequest<T>>
26 extends TransactionRequest<T> {
28 private static final long serialVersionUID = 1L;
30 private final boolean snapshotOnly;
32 AbstractReadTransactionRequest(final TransactionIdentifier identifier, final long sequence, final ActorRef replyTo,
33 final boolean snapshotOnly) {
34 super(identifier, sequence, replyTo);
35 this.snapshotOnly = snapshotOnly;
38 AbstractReadTransactionRequest(final T request, final ABIVersion version) {
39 super(request, version);
40 this.snapshotOnly = request.isSnapshotOnly();
43 public final boolean isSnapshotOnly() {
48 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
49 return super.addToStringAttributes(toStringHelper).add("snapshotOnly", snapshotOnly);
53 protected abstract AbstractReadTransactionRequestProxyV1<T> externalizableProxy(ABIVersion version);