Remove deprecated concepts.util.ListenerRegistry 14/11914/2
authorRobert Varga <rovarga@cisco.com>
Sun, 12 Oct 2014 11:53:41 +0000 (13:53 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 13 Oct 2014 09:03:15 +0000 (09:03 +0000)
This class has been deprecated for Helium release, now we are removing
it. Users should use org.opendaylight.yangtools.util.ListenerRegistry.

Change-Id: I4b74d7326641f4f5a86437b08e2b2ca34de8d2b5
Signed-off-by: Robert Varga <rovarga@cisco.com>
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/util/ListenerRegistry.java [deleted file]

diff --git a/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/util/ListenerRegistry.java b/common/concepts/src/main/java/org/opendaylight/yangtools/concepts/util/ListenerRegistry.java
deleted file mode 100644 (file)
index 07cc5ae..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2013 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.yangtools.concepts.util;
-
-
-import java.util.Collections;
-import java.util.EventListener;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-
-/**
- * @deprecated Use {@link org.opendaylight.yangtools.util.ListenerRegistry} instead.
- *
- * @param <T>
- */
-@Deprecated
-public class ListenerRegistry<T extends EventListener> implements Iterable<ListenerRegistration<T>> {
-
-    private final ConcurrentHashMap<ListenerRegistration<? extends T>,ListenerRegistration<? extends T>> listeners;
-    final Set<ListenerRegistration<T>> unmodifiableView;
-
-    @SuppressWarnings("unchecked")
-    public ListenerRegistry() {
-        listeners = new ConcurrentHashMap<>();
-        // This conversion is known to be safe.
-        @SuppressWarnings("rawtypes")
-        final Set rawSet = Collections.unmodifiableSet(listeners.keySet());
-        unmodifiableView = rawSet;
-    }
-
-    public Iterable<ListenerRegistration<T>> getListeners() {
-        return unmodifiableView;
-    }
-
-    public ListenerRegistration<T> register(final T listener) {
-        if (listener == null) {
-            throw new IllegalArgumentException("Listener should not be null.");
-        }
-        ListenerRegistrationImpl<T> ret = new ListenerRegistrationImpl<T>(listener);
-        listeners.put(ret,ret);
-        return ret;
-    }
-
-    public <L extends T> ListenerRegistration<L> registerWithType(final L listener) {
-        ListenerRegistrationImpl<L> ret = new ListenerRegistrationImpl<L>(listener);
-        listeners.put(ret,ret);
-        return ret;
-    }
-
-    @Override
-    public java.util.Iterator<ListenerRegistration<T>> iterator() {
-        return unmodifiableView.iterator();
-    }
-
-    @SuppressWarnings("rawtypes")
-    private void remove(final ListenerRegistrationImpl registration) {
-        listeners.remove(registration);
-    }
-
-    private class ListenerRegistrationImpl<P extends EventListener> extends AbstractObjectRegistration<P> implements ListenerRegistration<P> {
-
-        public ListenerRegistrationImpl(final P instance) {
-            super(instance);
-        }
-
-        @Override
-        protected void removeRegistration() {
-            ListenerRegistry.this.remove(this);
-        }
-    }
-
-    public static <T extends EventListener> ListenerRegistry<T> create() {
-        return new ListenerRegistry<>();
-    }
-}