X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fpersisted%2FShardManagerSnapshot.java;h=03ffa9af793a2778c07fb119a4360e1b6819bb3d;hb=63a3096137fc5c49dbf8475bca2d0c73295c4328;hp=93846758ec9eb5848e58773d64e395e3f9c90a03;hpb=c1336f9b497bc6867536a24f629c3f0b002ccb2f;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardManagerSnapshot.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardManagerSnapshot.java index 93846758ec..03ffa9af79 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardManagerSnapshot.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardManagerSnapshot.java @@ -8,28 +8,21 @@ package org.opendaylight.controller.cluster.datastore.persisted; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import javax.annotation.Nonnull; -import org.opendaylight.controller.cluster.datastore.config.PrefixShardConfiguration; -import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; +import org.eclipse.jdt.annotation.NonNull; /** * Represents the persisted snapshot state for the ShardManager. * * @author Thomas Pantelis */ -public class ShardManagerSnapshot implements Serializable { - private static final long serialVersionUID = 1L; - +public final class ShardManagerSnapshot implements Serializable { private static final class Proxy implements Externalizable { private static final long serialVersionUID = 1L; @@ -47,35 +40,22 @@ public class ShardManagerSnapshot implements Serializable { } @Override - public void writeExternal(ObjectOutput out) throws IOException { + public void writeExternal(final ObjectOutput out) throws IOException { out.writeInt(snapshot.shardList.size()); for (String shard: snapshot.shardList) { out.writeObject(shard); } - - out.writeInt(snapshot.prefixShardConfiguration.size()); - for (Map.Entry prefixShardConfigEntry : snapshot.prefixShardConfiguration.entrySet()) { - out.writeObject(prefixShardConfigEntry.getKey()); - out.writeObject(prefixShardConfigEntry.getValue()); - } } @Override - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { int size = in.readInt(); - List shardList = new ArrayList<>(size); + List localShardList = new ArrayList<>(size); for (int i = 0; i < size; i++) { - shardList.add((String) in.readObject()); + localShardList.add((String) in.readObject()); } - size = in.readInt(); - Map prefixShardConfiguration = new HashMap<>(size); - for (int i = 0; i < size; i++) { - prefixShardConfiguration.put((DOMDataTreeIdentifier) in.readObject(), - (PrefixShardConfiguration) in.readObject()); - } - - snapshot = new ShardManagerSnapshot(shardList, prefixShardConfiguration); + snapshot = new ShardManagerSnapshot(localShardList); } private Object readResolve() { @@ -83,17 +63,16 @@ public class ShardManagerSnapshot implements Serializable { } } + private static final long serialVersionUID = 1L; + private final List shardList; - private final Map prefixShardConfiguration; - public ShardManagerSnapshot(@Nonnull final List shardList, - final Map prefixShardConfiguration) { + public ShardManagerSnapshot(final @NonNull List shardList) { this.shardList = ImmutableList.copyOf(shardList); - this.prefixShardConfiguration = ImmutableMap.copyOf(prefixShardConfiguration); } public List getShardList() { - return this.shardList; + return shardList; } private Object writeReplace() {