2 * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.access.concepts;
10 import static com.google.common.base.Verify.verifyNotNull;
11 import static java.util.Objects.requireNonNull;
13 import java.io.Externalizable;
14 import java.io.IOException;
15 import java.io.ObjectInput;
16 import java.io.ObjectOutput;
17 import org.opendaylight.yangtools.concepts.WritableObjects;
20 * Serialization proxy for {@link TransactionIdentifier}.
22 final class TI implements Externalizable {
24 private static final long serialVersionUID = 1L;
26 private TransactionIdentifier identifier;
28 @SuppressWarnings("checkstyle:RedundantModifier")
33 TI(final TransactionIdentifier identifier) {
34 this.identifier = requireNonNull(identifier);
38 public void readExternal(final ObjectInput in) throws IOException {
39 identifier = new TransactionIdentifier(LocalHistoryIdentifier.readFrom(in), WritableObjects.readLong(in));
43 public void writeExternal(final ObjectOutput out) throws IOException {
44 identifier.getHistoryId().writeTo(out);
45 WritableObjects.writeLong(out, identifier.getTransactionId());
49 private Object readResolve() {
50 return verifyNotNull(identifier);