Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / TDCR.java
1 /*
2  * Copyright (c) 2022 PANTHEON.tech, s.r.o. 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 static com.google.common.base.Verify.verifyNotNull;
11 import static java.util.Objects.requireNonNull;
12
13 /**
14  * Externalizable proxy for use with {@link TransactionDoCommitRequest}. It implements the Chlorine SR2 serialization
15  * format.
16  */
17 final class TDCR implements TransactionDoCommitRequest.SerialForm {
18     @java.io.Serial
19     private static final long serialVersionUID = 1L;
20
21     private TransactionDoCommitRequest message;
22
23     @SuppressWarnings("checkstyle:RedundantModifier")
24     public TDCR() {
25         // for Externalizable
26     }
27
28     TDCR(final TransactionDoCommitRequest message) {
29         this.message = requireNonNull(message);
30     }
31
32     @Override
33     public TransactionDoCommitRequest message() {
34         return verifyNotNull(message);
35     }
36
37     @Override
38     public void setMessage(final TransactionDoCommitRequest message) {
39         this.message = requireNonNull(message);
40     }
41
42     @Override
43     public Object readResolve() {
44         return message();
45     }
46 }