2 * Copyright (c) 2017 Inocybe Technologies 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.raft.behaviors;
10 import java.io.Externalizable;
11 import java.io.IOException;
12 import java.io.ObjectInput;
13 import java.io.ObjectOutput;
14 import org.opendaylight.yangtools.util.AbstractStringIdentifier;
17 * An Identifier for a follower.
19 * @author Thomas Pantelis
21 class FollowerIdentifier extends AbstractStringIdentifier<FollowerIdentifier> {
22 private static final long serialVersionUID = 1L;
24 FollowerIdentifier(String followerId) {
28 private Object writeReplace() {
29 return new Proxy(this);
32 private static class Proxy implements Externalizable {
33 private static final long serialVersionUID = 1L;
35 private FollowerIdentifier identifier;
37 // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
38 // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
39 @SuppressWarnings("checkstyle:RedundantModifier")
43 Proxy(FollowerIdentifier identifier) {
44 this.identifier = identifier;
48 public void writeExternal(ObjectOutput out) throws IOException {
49 out.writeObject(identifier.getValue());
53 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
54 identifier = new FollowerIdentifier((String) in.readObject());
57 private Object readResolve() {