Simplifying removeListener to merely log when remove indicates no such listener.

Change-Id: I6d47fd70938b5e049e523f94d3e7242661fb154d
diff --git a/core/api/src/main/java/org/onosproject/event/ListenerRegistry.java b/core/api/src/main/java/org/onosproject/event/ListenerRegistry.java
index c2e1aed..6a570c5 100644
--- a/core/api/src/main/java/org/onosproject/event/ListenerRegistry.java
+++ b/core/api/src/main/java/org/onosproject/event/ListenerRegistry.java
@@ -20,7 +20,6 @@
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 
-import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.slf4j.LoggerFactory.getLogger;
 
@@ -33,8 +32,6 @@
 
     private final Logger log = getLogger(getClass());
 
-    private volatile boolean shutdown = false;
-
     private long lastStart;
     private L lastListener;
 
@@ -61,8 +58,8 @@
      */
     public void removeListener(L listener) {
         checkNotNull(listener, "Listener cannot be null");
-        if (checkForNonRegistrant()) {
-            checkArgument(listeners.remove(listener), "Listener not registered");
+        if (!listeners.remove(listener)) {
+            log.warn("Listener {} not registered", listener);
         }
     }
 
@@ -91,41 +88,13 @@
     }
 
     /**
-     * Predicate indicating whether we should throw an exception if the
-     * argument to {@link #removeListener} is not in the current set of
-     * listeners.
-     * <p>
-     * This default implementation returns <code>true</code>.
-     *
-     * @return true if non-listed listeners should cause exception on remove
-     */
-    protected boolean checkForNonRegistrant() {
-        return true;
-    }
-
-    /**
      * Reports a problem encountered while processing an event.
      *
      * @param event event being processed
      * @param error error encountered while processing
      */
     protected void reportProblem(E event, Throwable error) {
-        if (!shutdown) {
-            log.warn("Exception encountered while processing event " + event, error);
-        }
+        log.warn("Exception encountered while processing event " + event, error);
     }
 
-    /**
-     * Prepares the registry for normal operation.
-     */
-    public void activate() {
-        shutdown = false;
-    }
-
-    /**
-     * Prepares the registry for shutdown.
-     */
-    public void deactivate() {
-        shutdown = true;
-    }
 }
diff --git a/core/api/src/test/java/org/onosproject/event/ListenerRegistryTest.java b/core/api/src/test/java/org/onosproject/event/ListenerRegistryTest.java
index 5645926..8cce641 100644
--- a/core/api/src/test/java/org/onosproject/event/ListenerRegistryTest.java
+++ b/core/api/src/test/java/org/onosproject/event/ListenerRegistryTest.java
@@ -26,13 +26,6 @@
  */
 public class ListenerRegistryTest {
 
-    private static class RelaxedRegistry extends TestListenerRegistry {
-        @Override
-        protected boolean checkForNonRegistrant() {
-            return false;
-        }
-    }
-
     private static final TestEvent FOO_EVENT =
             new TestEvent(TestEvent.Type.FOO, "foo");
     private static final TestEvent BAR_EVENT =
@@ -78,16 +71,4 @@
         assertTrue("BAR not processed", secondListener.events.contains(BAR_EVENT));
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void removeNonListenerCausesException() {
-        manager.removeListener(listener);
-    }
-
-    @Test
-    public void removeNonListenerIgnored() {
-        manager = new RelaxedRegistry();
-        manager.removeListener(listener);
-        assertTrue("what?", manager.listeners.isEmpty());
-    }
-
 }
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/ModelListenerRegistry.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/ModelListenerRegistry.java
index eacbbaf..ae29da4 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/ModelListenerRegistry.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/ModelListenerRegistry.java
@@ -59,8 +59,4 @@
         }
     }
 
-    @Override
-    protected boolean checkForNonRegistrant() {
-        return false;
-    }
 }