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.datastore.persisted;
10 import com.google.common.collect.ImmutableList;
11 import java.io.Externalizable;
12 import java.io.IOException;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
15 import java.util.List;
18 * Externalizable proxy for {@link FrontendShardDataTreeSnapshotMetadata}.
20 final class FM implements Externalizable {
22 private static final long serialVersionUID = 1L;
24 private List<FrontendClientMetadata> clients;
26 @SuppressWarnings("checkstyle:RedundantModifier")
31 FM(final FrontendShardDataTreeSnapshotMetadata metadata) {
32 clients = metadata.getClients();
36 public void writeExternal(final ObjectOutput out) throws IOException {
37 out.writeInt(clients.size());
38 for (var c : clients) {
44 public void readExternal(final ObjectInput in) throws IOException {
45 final int size = in.readInt();
46 final var builder = ImmutableList.<FrontendClientMetadata>builderWithExpectedSize(size);
47 for (int i = 0; i < size ; ++i) {
48 builder.add(FrontendClientMetadata.readFrom(in));
50 clients = builder.build();
54 private Object readResolve() {
55 return new FrontendShardDataTreeSnapshotMetadata(clients);