Deprecate ListenerRegistration for removal 27/109227/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 8 Dec 2023 16:37:15 +0000 (17:37 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 8 Dec 2023 16:38:10 +0000 (17:38 +0100)
This interface brings very little to the table and binds to
j.u.EventListener as if it were a good idea. Deprecate it for removal,
guiding users towards ObjectRegistration instead.

JIRA: YANGTOOLS-1551
Change-Id: Id621532b52bb7d9d4cea335d6841bf110a68af62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractListenerRegistration.java
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/ListenerRegistration.java
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/NoOpListenerRegistration.java
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/Registration.java

index 872816affd0a12718d3c4d10312121dac06876e0..982e7c9e48a2ed839970fd0f58f8a127877362c8 100644 (file)
@@ -10,9 +10,9 @@ package org.opendaylight.yangtools.concepts;
 import java.util.EventListener;
 import org.eclipse.jdt.annotation.NonNull;
 
+@Deprecated(since = "12.0.0", forRemoval = true)
 public abstract class AbstractListenerRegistration<T extends EventListener> extends AbstractObjectRegistration<T>
         implements ListenerRegistration<T> {
-
     protected AbstractListenerRegistration(final @NonNull T listener) {
         super(listener);
     }
index 02d0d609259a08e35ef6e71fda1fc52ecdaf6df3..7022292b440a20d898942f72f0b1af5484924fbc 100644 (file)
@@ -14,7 +14,9 @@ import java.util.EventListener;
  * guarantee that the process of unregistration cannot fail for predictable reasons.
  *
  * @param <T> Type of registered listener
+ * @deprecated Use {@link ObjectRegistration} instead
  */
+@Deprecated(since = "12.0.0", forRemoval = true)
 public interface ListenerRegistration<T extends EventListener> extends ObjectRegistration<T> {
     /**
      * Unregister the listener. Note that invocations enqueued to the listener are not subject to synchronization
index 26e2ca790f0855efee34afc06a0ccb0e9add6cc1..73740e8dca6671102ab0ab9c7e25838d83e062d9 100644 (file)
@@ -14,8 +14,10 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
  * Implementation of {@link ListenerRegistration} which does nothing in its {@link #close()} method.
  *
  * @param <T> Type of registered listener
+ * @deprecated Use {@link NoOpObjectRegistration} instead
  */
 @NonNullByDefault
+@Deprecated(since = "12.0.0", forRemoval = true)
 public final class NoOpListenerRegistration<T extends EventListener> extends NoOpObjectRegistration<T>
         implements ListenerRegistration<T> {
     private NoOpListenerRegistration(final T instance) {
index c166eb639407333f1112bcf412f56f01c0c84ee1..cbf0a2aac9cea301e8b736fea2affcb38e4b2183 100644 (file)
@@ -16,6 +16,15 @@ public interface Registration extends AutoCloseable {
      * Unregisters the object. This operation is required not to invoke blocking operations. Implementations which
      * require interaction with outside world must provide guarantees that any work is done behind the scenes and
      * the unregistration process looks as if it has already succeeded once this method returns.
+     *
+     * <p>
+     * The above requirement does not necessarily mean that all interactions with the registered entity seize before
+     * this method returns, but they should complete within a reasonable time frame.
+     *
+     * <p>
+     * While the interface contract allows an implementation to ignore the occurrence of RuntimeExceptions,
+     * implementations are strongly encouraged to deal with such exceptions internally and to ensure invocations of
+     * this method do not fail in such circumstances.
      */
     @Override
     void close();