Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / ExistsTransactionSuccessProxyV1.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.IOException;
11 import java.io.ObjectInput;
12 import java.io.ObjectOutput;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14
15 /**
16  * Externalizable proxy for use with {@link ExistsTransactionSuccess}. It implements the initial (Boron) serialization
17  * format.
18  *
19  * @author Robert Varga
20  */
21 final class ExistsTransactionSuccessProxyV1 extends AbstractTransactionSuccessProxy<ExistsTransactionSuccess> {
22     private static final long serialVersionUID = 1L;
23     private boolean exists;
24
25     // checkstyle flags the public modifier as redundant however it is explicitly needed for Java serialization to
26     // be able to create instances via reflection.
27     @SuppressWarnings("checkstyle:RedundantModifier")
28     public ExistsTransactionSuccessProxyV1() {
29         // For Externalizable
30     }
31
32     ExistsTransactionSuccessProxyV1(final ExistsTransactionSuccess request) {
33         super(request);
34         this.exists = request.getExists();
35     }
36
37     @Override
38     public void writeExternal(final ObjectOutput out) throws IOException {
39         super.writeExternal(out);
40         out.writeBoolean(exists);
41     }
42
43     @Override
44     public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
45         super.readExternal(in);
46         exists = in.readBoolean();
47     }
48
49     @Override
50     protected ExistsTransactionSuccess createSuccess(final TransactionIdentifier target, final long sequence) {
51         return new ExistsTransactionSuccess(target, sequence, exists);
52     }
53 }