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 90b069e..9e69fa6 100644 (file)
@@ -33,8 +33,7 @@ public class RoutingTable implements BucketData<RoutingTable>, Serializable {
         this(router, new HashMap<>());
     }
 
-    @Override
-    public RoutingTable copy() {
+    RoutingTable copy() {
         return new RoutingTable(router, new HashMap<>(table));
     }
 
index 6da3d94..54e9471 100644 (file)
@@ -17,7 +17,7 @@ import java.util.Optional;
  *
  * @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.
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 a5b0fbe..4e3961a 100644 (file)
@@ -33,11 +33,6 @@ public class BucketStoreTest {
      *
      */
     private static class T implements BucketData<T> {
-        @Override
-        public T copy() {
-            return new T();
-        }
-
         @Override
         public Optional<ActorRef> getWatchActor() {
             return Optional.empty();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.