Remove Copier interface 91/50591/11
authorRobert Varga <rovarga@cisco.com>
Wed, 18 Jan 2017 00:37:28 +0000 (01:37 +0100)
committerRobert Varga <rovarga@cisco.com>
Mon, 30 Jan 2017 13:52:44 +0000 (14:52 +0100)
This is an abstraction which is completely unneeded
at the Bucket level, as BucketData is expected to be immutable
and it is only mutated in RpcRegistry, which has a package-private
relationship with RoutingTable.

Rather than forcing an interface to be implemented and not used,
remove Copier and let RpcRegistry deal with RoutingTable however
seewit sees fit.

Change-Id: Id96a113638d0240c2f0aa9321c5fc4b4e2384a79
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketData.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Copier.java [deleted file]
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketStoreTest.java

index 90b069e58785aa95c50b36734aee9d5eaadffab4..9e69fa66df463c25f0c9c29562c9d1f015e642a8 100644 (file)
@@ -33,8 +33,7 @@ public class RoutingTable implements BucketData<RoutingTable>, Serializable {
         this(router, new HashMap<>());
     }
 
         this(router, new HashMap<>());
     }
 
-    @Override
-    public RoutingTable copy() {
+    RoutingTable copy() {
         return new RoutingTable(router, new HashMap<>(table));
     }
 
         return new RoutingTable(router, new HashMap<>(table));
     }
 
index 6da3d947c633a3d423c82b7174c463dbcf3c9960..54e947123372259c036f3868d9cd625325452bd8 100644 (file)
@@ -17,7 +17,7 @@ import java.util.Optional;
  *
  * @param <T> Concrete BucketData type
  */
  *
  * @param <T> Concrete BucketData type
  */
-public interface BucketData<T extends BucketData<T>> extends Copier<T> {
+public interface BucketData<T extends BucketData<T>> {
     /**
      * Return the {@link ActorRef} which should be tracked as the authoritative source of this bucket's data.
      * The bucket will be invalidated should the actor be reported as Terminated.
     /**
      * Return the {@link ActorRef} which should be tracked as the authoritative source of this bucket's data.
      * The bucket will be invalidated should the actor be reported as Terminated.
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Copier.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Copier.java
deleted file mode 100644 (file)
index 83dbbf0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.remote.rpc.registry.gossip;
-
-/**
- * Type of data that goes in {@link org.opendaylight.controller.remote.rpc.registry.gossip.Bucket}.
- * The implementers should do deep cloning in copy() method.
- */
-public interface Copier<T> {
-    T copy();
-}
index a5b0fbedda9a07962abba5aad69569034f816916..4e3961aac139f653a8886bf5eb18937891df21c9 100644 (file)
@@ -33,11 +33,6 @@ public class BucketStoreTest {
      *
      */
     private static class T implements BucketData<T> {
      *
      */
     private static class T implements BucketData<T> {
-        @Override
-        public T copy() {
-            return new T();
-        }
-
         @Override
         public Optional<ActorRef> getWatchActor() {
             return Optional.empty();
         @Override
         public Optional<ActorRef> getWatchActor() {
             return Optional.empty();