Class AbstractRegistration

java.lang.Object
org.opendaylight.yangtools.concepts.AbstractRegistration
All Implemented Interfaces:
AutoCloseable, Registration
Direct Known Subclasses:
AbstractObjectRegistration

public abstract class AbstractRegistration extends Object implements Registration
Utility registration handle. It is a convenience for register-style method which can return an AutoCloseable realized by a subclass of this class. Invoking the close() method triggers unregistration of the state the method installed.
  • Constructor Details

    • AbstractRegistration

      public AbstractRegistration()
  • Method Details

    • removeRegistration

      protected abstract void removeRegistration()
      Remove the state referenced by this registration. This method is guaranteed to be called at most once. Referenced state must be retained until this method is invoked.
    • isClosed

      public final boolean isClosed()
      Query the state of this registration. Returns true if it was closed. Equivalent of !notClosed().
      Returns:
      true if the registration was closed, false otherwise.
    • notClosed

      public final boolean notClosed()
      Query the state of this registration. Returns false if it was closed. Equivalent of !isClosed().
      Returns:
      false if the registration was closed, true otherwise.
    • close

      public final void close()
      Description copied from interface: Registration
      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.

      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.

      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.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Registration
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • addToStringAttributes

      protected MoreObjects.ToStringHelper addToStringAttributes(MoreObjects.ToStringHelper toStringHelper)