BUG-5280: introduce base Transaction request/success
[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>> extends TransactionRequest<T> {
24     private static final long serialVersionUID = 1L;
25
26     AbstractLocalTransactionRequest(final TransactionIdentifier identifier, final long sequence, final long retry,
27         final ActorRef replyTo) {
28         super(identifier, sequence, retry, replyTo);
29     }
30
31     AbstractLocalTransactionRequest(final T request, final long retry) {
32         super(request, retry);
33     }
34
35     @Override
36     protected final AbstractTransactionRequestProxy<T> externalizableProxy(final ABIVersion version) {
37         throw new UnsupportedOperationException("Local transaction request should never be serialized");
38     }
39
40     @SuppressWarnings("unchecked")
41     @Override
42     protected final T cloneAsVersion(final ABIVersion version) {
43         // These messages cannot be serialized, hence we this method is a no-op
44         return (T)this;
45     }
46 }