Remove RoutingLogic interface 53/74853/1
authorTom Pantelis <tompantelis@gmail.com>
Mon, 6 Aug 2018 12:56:43 +0000 (08:56 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Mon, 6 Aug 2018 12:56:43 +0000 (08:56 -0400)
This is no longer used...

Change-Id: I167eed99d7e457a7d6b1d53f39c07a1dfc6c5bf3
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogic.java [deleted file]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/RoutingLogic.java [deleted file]
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java [deleted file]

diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogic.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogic.java
deleted file mode 100644 (file)
index f7b36a7..0000000
+++ /dev/null
@@ -1,66 +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.utils;
-
-import akka.actor.ActorRef;
-import akka.japi.Pair;
-import com.google.common.base.Preconditions;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-/**
- * This class will return First Entry.
- */
-public class LatestEntryRoutingLogic implements RoutingLogic {
-
-    private final SortedSet<Pair<ActorRef, Long>> actorRefSet;
-
-    public LatestEntryRoutingLogic(Collection<Pair<ActorRef, Long>> entries) {
-        Preconditions.checkNotNull(entries, "Entries should not be null");
-        Preconditions.checkArgument(!entries.isEmpty(), "Entries collection should not be empty");
-
-        actorRefSet = new TreeSet<>(new LatestEntryComparator());
-        actorRefSet.addAll(entries);
-    }
-
-    @Override
-    public ActorRef select() {
-        return actorRefSet.last().first();
-    }
-
-    private static class LatestEntryComparator implements Comparator<Pair<ActorRef, Long>>, Serializable {
-        private static final long serialVersionUID = 1L;
-
-        @Override
-        public int compare(Pair<ActorRef, Long> o1, Pair<ActorRef, Long> o2) {
-            if (o1 == null && o2 == null) {
-                return 0;
-            }
-
-            if (o1 != null && o2 != null && o1.second() == null && o2.second() == null) {
-                return 0;
-            }
-
-            if ((o1 == null || o1.second() == null) && o2 != null) {
-                return -1;
-            }
-
-            if (o2 == null || o2.second() == null) {
-                return 1;
-            }
-
-            return o1.second().compareTo(o2.second());
-        }
-    }
-}
-
-
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/RoutingLogic.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/RoutingLogic.java
deleted file mode 100644 (file)
index c7096f5..0000000
+++ /dev/null
@@ -1,21 +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.utils;
-
-import akka.actor.ActorRef;
-
-/**
- * This Interface is added to abstract out the way rpc execution could be
- * routed, if more than one node in cluster is capable of executing the rpc.
- * We can pick node randomly, round robin manner or based on last updated time etc.
- */
-
-public interface RoutingLogic {
-    ActorRef select();
-}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java
deleted file mode 100644 (file)
index b8ddc37..0000000
+++ /dev/null
@@ -1,54 +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.utils;
-
-import static org.junit.Assert.assertTrue;
-
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import akka.japi.Pair;
-import akka.testkit.TestProbe;
-import akka.testkit.javadsl.TestKit;
-import com.typesafe.config.ConfigFactory;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class LatestEntryRoutingLogicTest {
-    static ActorSystem system;
-
-    @BeforeClass
-    public static void setup() {
-        system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
-    }
-
-    @AfterClass
-    public static void teardown() {
-        TestKit.shutdownActorSystem(system);
-        system = null;
-    }
-
-    @Test
-    public void testRoutingLogic() {
-        List<Pair<ActorRef, Long>> pairList = new ArrayList<>();
-        TestProbe probe1 = new TestProbe(system);
-        TestProbe probe2 = new TestProbe(system);
-        TestProbe probe3 = new TestProbe(system);
-        ActorRef actor1 = probe1.ref();
-        ActorRef actor2 = probe2.ref();
-        ActorRef actor3 = probe3.ref();
-        pairList.add(new Pair<>(actor1, 1000L));
-        pairList.add(new Pair<>(actor2, 3000L));
-        pairList.add(new Pair<>(actor3, 2000L));
-        RoutingLogic logic = new LatestEntryRoutingLogic(pairList);
-        assertTrue(logic.select().equals(actor2));
-    }
-}

©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.