BUG-8309: Add message identity information
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / AbstractLocalTransactionRequest.java
1 /*
2  * Copyright (c) 2016 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.access.commands;
9
10 import akka.actor.ActorRef;
11 import org.opendaylight.controller.cluster.access.ABIVersion;
12 import org.opendaylight.controller.cluster.access.concepts.Request;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14
15 /**
16  * Abstract base class for {@link Request}s involving specific transactions local to a member node. These transactions
17  * take advantage of isolation provided by the DataTree, performing transaction modifications on the frontend.
18  *
19  * @author Robert Varga
20  *
21  * @param <T> Message type
22  */
23 abstract class AbstractLocalTransactionRequest<T extends AbstractLocalTransactionRequest<T>>
24         extends TransactionRequest<T> {
25     private static final long serialVersionUID = 1L;
26
27     AbstractLocalTransactionRequest(final TransactionIdentifier identifier, final long sequence,
28             final ActorRef replyTo) {
29         super(identifier, sequence, replyTo);
30     }
31
32     @Override
33     protected final AbstractTransactionRequestProxy<T> externalizableProxy(final ABIVersion version) {
34         throw new UnsupportedOperationException("Local transaction request " + this + " should never be serialized");
35     }
36
37     @SuppressWarnings("unchecked")
38     @Override
39     protected final T cloneAsVersion(final ABIVersion version) {
40         // These messages cannot be serialized, hence we this method is a no-op
41         return (T)this;
42     }
43 }