Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / TransactionFailure.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 java.io.DataInput;
11 import java.io.IOException;
12 import org.opendaylight.controller.cluster.access.ABIVersion;
13 import org.opendaylight.controller.cluster.access.concepts.RequestException;
14 import org.opendaylight.controller.cluster.access.concepts.RequestFailure;
15 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
16
17 /**
18  * Generic {@link RequestFailure} involving a {@link TransactionRequest}.
19  */
20 public final class TransactionFailure extends RequestFailure<TransactionIdentifier, TransactionFailure> {
21     interface SerialForm extends RequestFailure.SerialForm<TransactionIdentifier, TransactionFailure> {
22         @Override
23         default TransactionIdentifier readTarget(final DataInput in) throws IOException {
24             return TransactionIdentifier.readFrom(in);
25         }
26
27         @Override
28         default TransactionFailure createFailure(final TransactionIdentifier target, final long sequence,
29                 final RequestException cause) {
30             return new TransactionFailure(target, sequence, cause);
31         }
32     }
33
34     @java.io.Serial
35     private static final long serialVersionUID = 1L;
36
37     private TransactionFailure(final TransactionFailure failure, final ABIVersion version) {
38         super(failure, version);
39     }
40
41     TransactionFailure(final TransactionIdentifier target, final long sequence, final RequestException cause) {
42         super(target, sequence, cause);
43     }
44
45     @Override
46     protected TransactionFailure cloneAsVersion(final ABIVersion version) {
47         return new TransactionFailure(this, version);
48     }
49
50     @Override
51     protected SerialForm externalizableProxy(final ABIVersion version) {
52         return new TF(this);
53     }
54 }